#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
enum class enum_test {
value_one,
value_two,
value_three,
value_four
};
explicit operator auto()
const noexcept {
return xtd::enum_collection<enum_test> {{enum_test::value_one,
"value_one"}, {enum_test::value_two,
"value_two"}, {enum_test::value_three,
"value_three"}, {enum_test::value_four,
"value_four"}};}
};
auto main() -> int {
console::write_line("name = {}", enum_test::value_four);
console::write_line(
"value = {}",
enum_object(enum_test::value_four).to_int32());
console::write_line("as<int> = {}", as<int>(enum_test::value_four));
}
Provides the base class for enumerations.
Definition enum_object.h:42
std::vector< xtd::collections::generic::key_value_pair< enum_t, xtd::string > > enum_collection
Represents a pair of an enum_t value and a string of an enum of type enum_t.
Definition enum_collection.h:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Provides the registration struct for enumerations.
Definition enum_register.h:38