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