#programowanie #cpp mam sobie enum class jakiś i wartość po cascie na int jest zapisywana do bazy danych. Czy mam pewność, że te wartości zawsze będą takie same, po kolei? Bez względu na to, że np. skompilowałem program po zmianach i np. po roku, to wczytując z tej bazy danych tego inta i castując na enuma będzie to samo? Czy jednak muszę pisać = 0, = 1, = 2 itd?
When initializers are provided in the enumerator-list, the values of enumerators are defined by those initializers. If the first enumerator does not have an initializer, the associated value is zero. For any other enumerator whose definition does not have an initializer, the associated value is the value of the previous enumerator plus one.
Te wartości są dobrze zdefiniowane i się nie zmienią.
@ZjedliMiRogale: @grzegorzx86: dziękuję, próbowałem googlać, ale miałem trudność, bo słowa takie jak stały czy statyczny już coś znaczą, a nie wiedziałem jak to inaczej ubrać w słowa. :P
Komentarz usunięty przez autora
When initializers are provided in the enumerator-list, the values of enumerators are defined by those initializers. If the first enumerator does not have an initializer, the associated value is zero. For any other enumerator whose definition does not have an initializer, the associated value is the value of the previous enumerator plus one.
Te wartości są dobrze zdefiniowane i się nie zmienią.