Documentation for Ice 3.5. The latest release is Ice 3.7. Refer to the space directory for other releases.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

A Slice enumeration maps to the corresponding enumeration in C++. For example:

Slice
enum Fruit { Apple, Pear, Orange };

Not surprisingly, the generated C++ definition is identical:

C++
enum Fruit { Apple, Pear, Orange };

Suppose we modify the Slice definition to include a custom enumerator value:

Slice
enum Fruit { Apple, Pear = 3, Orange };

The generated C++ definition now includes an explicit initializer for every enumerator:

C++
enum Fruit { Apple = 0, Pear = 3, Orange = 4 };

See Also

  • No labels