Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Enums

Relevant portion of the pybind11 manual and of the nanobind manual

litgen handles enum and enum class enums.

Classic C enums

See example below:

  • litgen automatically remove the standard prefix from enum values: Foo::Foo_a is exposed as Foo.a

  • comments about values are preserved in the stub

  • litgen automatically handles the enum numbering and outputs the values as a comment in the stub

  • if some macro values are used (like MY_VALUE), we can set their value

  • Computed values are also correctly exposed (see Foo.d)

Loading...

C++ enums: enum class

enum class is also supported, see example below:

Loading...

Arithmetic enums

Use options.enum_make_arithmetic__regex to make the enum arithmetic in python, so that it can be converted to a number in python.

Loading...