I want to have a wrapper around an enumeration that will give me the ability to convert it to a string and vice versa.
The base class is as follows:
template<typename TEnum>
class StringConvertedEnum {
public:
static std::string toString(TEnum e);
static TEnum toEnum(std::string &str);
protected:
static const std::map<std::string, TEnum> _stringMapping;
static const std::map<TEnum, std::string> _enumMapping;
};
And then I want to have something like this:
class Category : public StringConvertedEnum<Category::Enum> {
public:
enum Enum {
Category1,
Category2,
OTHER
};
};
However, at the moment it is not compiled with this error:
incomplete type 'enums::Category' used in nested name specifier
How to solve this problem?
source
share