C++ error: expected unqualifed-id before 'explicit' [closed]











up vote
-3
down vote

favorite












I've seen posts everywhere about this but can't get past my own situation. It's been a long time since I've developed in C++. I am also bound to using C++98. The following is all in one header file:



template<typename K, typename V> {
class BoundedMap
{
private:
std::map<K, V> mMap;
const K mDefaultValue;
unsigned int mBounds;

public:
BoundedMap(const K& defaultValue, unsigned int bounds):
mDefaultValue(defaultValue), mBounds(bounds) {}

V& operator(const K& key) {
if (mMap.size() < mBounds) {
return mMap[key];
}
return mDefaultValue;
}
};


The error I'm getting is:



error: expected unqualified-id before 'explicit'
error: expected ')' before ''explicit'
error: 'template <class _Key, class _Tp, class _Compare, class _Alloc> class std::map used without template parameters
error: ISO C++ forbids declaration of 'iterator' with no type









share|improve this question













closed as off-topic by Heslacher, Incomputable, Malachi Nov 26 at 15:28


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, Incomputable, Malachi

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
    – Heslacher
    Nov 26 at 14:01










  • Stackoverflow then. Thanks.
    – jiveturkey
    Nov 26 at 14:18















up vote
-3
down vote

favorite












I've seen posts everywhere about this but can't get past my own situation. It's been a long time since I've developed in C++. I am also bound to using C++98. The following is all in one header file:



template<typename K, typename V> {
class BoundedMap
{
private:
std::map<K, V> mMap;
const K mDefaultValue;
unsigned int mBounds;

public:
BoundedMap(const K& defaultValue, unsigned int bounds):
mDefaultValue(defaultValue), mBounds(bounds) {}

V& operator(const K& key) {
if (mMap.size() < mBounds) {
return mMap[key];
}
return mDefaultValue;
}
};


The error I'm getting is:



error: expected unqualified-id before 'explicit'
error: expected ')' before ''explicit'
error: 'template <class _Key, class _Tp, class _Compare, class _Alloc> class std::map used without template parameters
error: ISO C++ forbids declaration of 'iterator' with no type









share|improve this question













closed as off-topic by Heslacher, Incomputable, Malachi Nov 26 at 15:28


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, Incomputable, Malachi

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
    – Heslacher
    Nov 26 at 14:01










  • Stackoverflow then. Thanks.
    – jiveturkey
    Nov 26 at 14:18













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I've seen posts everywhere about this but can't get past my own situation. It's been a long time since I've developed in C++. I am also bound to using C++98. The following is all in one header file:



template<typename K, typename V> {
class BoundedMap
{
private:
std::map<K, V> mMap;
const K mDefaultValue;
unsigned int mBounds;

public:
BoundedMap(const K& defaultValue, unsigned int bounds):
mDefaultValue(defaultValue), mBounds(bounds) {}

V& operator(const K& key) {
if (mMap.size() < mBounds) {
return mMap[key];
}
return mDefaultValue;
}
};


The error I'm getting is:



error: expected unqualified-id before 'explicit'
error: expected ')' before ''explicit'
error: 'template <class _Key, class _Tp, class _Compare, class _Alloc> class std::map used without template parameters
error: ISO C++ forbids declaration of 'iterator' with no type









share|improve this question













I've seen posts everywhere about this but can't get past my own situation. It's been a long time since I've developed in C++. I am also bound to using C++98. The following is all in one header file:



template<typename K, typename V> {
class BoundedMap
{
private:
std::map<K, V> mMap;
const K mDefaultValue;
unsigned int mBounds;

public:
BoundedMap(const K& defaultValue, unsigned int bounds):
mDefaultValue(defaultValue), mBounds(bounds) {}

V& operator(const K& key) {
if (mMap.size() < mBounds) {
return mMap[key];
}
return mDefaultValue;
}
};


The error I'm getting is:



error: expected unqualified-id before 'explicit'
error: expected ')' before ''explicit'
error: 'template <class _Key, class _Tp, class _Compare, class _Alloc> class std::map used without template parameters
error: ISO C++ forbids declaration of 'iterator' with no type






c++ template






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 at 13:45









jiveturkey

95




95




closed as off-topic by Heslacher, Incomputable, Malachi Nov 26 at 15:28


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, Incomputable, Malachi

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Heslacher, Incomputable, Malachi Nov 26 at 15:28


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, Incomputable, Malachi

If this question can be reworded to fit the rules in the help center, please edit the question.












  • Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
    – Heslacher
    Nov 26 at 14:01










  • Stackoverflow then. Thanks.
    – jiveturkey
    Nov 26 at 14:18


















  • Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
    – Heslacher
    Nov 26 at 14:01










  • Stackoverflow then. Thanks.
    – jiveturkey
    Nov 26 at 14:18
















Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
Nov 26 at 14:01




Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
Nov 26 at 14:01












Stackoverflow then. Thanks.
– jiveturkey
Nov 26 at 14:18




Stackoverflow then. Thanks.
– jiveturkey
Nov 26 at 14:18















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Сан-Квентин

8-я гвардейская общевойсковая армия

Алькесар