A Slice enumeration maps to the corresponding enumeration in C++. For example:
{zcode:slice} enum Fruit { Apple, Pear, Orange }; {zcode} |
Not surprisingly, the generated C++ definition is identical:
{zcode:cpp} enum Fruit { Apple, Pear, Orange }; {zcode} |
Suppose we modify the Slice definition to include a custom enumerator value:
{zcode:slice} enum Fruit { Apple, Pear = 3, Orange }; {zcode} |
The generated C++ definition now includes an explicit initializer for every enumerator:
{zcode:cpp} enum Fruit { Apple = 0, Pear = 3, Orange = 4 }; {zcode} |