'Create a enum class and enumerate inmutable objects of that class using C++
Im trying to create a Timezone enum in C++ and I enumerate the values this way:
Timezone englandTZ(TimeChangeRule{"SDT", Last, Sun, Mar, 4, 0},TimeChangeRule{"SST", Last, Sun, Sept, 7, 60});
enum TIMEZONE {
ENGLAND = englandTZ
};
But when compiling it raises the error
error: the value of 'englandTZ' is not usable in a constant expression
Timezone and TimeChangeRule are classes. I think the error is because the object EnglandTZ is not a constant expression? How could I create a enum class and enumerate the inmutable objects of that class like in Java but using C++?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
