#include <xtd/as>
#include <xtd/console>
#include <xtd/enum_class>
value_one,
value_two,
value_three,
value_four
);
auto main() -> int {
try {
}
if (enum_object<>::try_parse<enum_test>(
"value_three", result))
console::write_line(
"result = {}", result);
if (enum_object<>::try_parse<enum_test>(
"vAlUe_OnE",
true, result))
console::write_line(
"result = {}", result);
if (enum_object<>::try_parse<enum_test>(
"value_six", result))
console::write_line(
"result = {}", result);
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
#define enum_class_(namespace_name, enum_class_t,...)
Provides the registration struct for enum class.
Definition enum_class.hpp:52
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
static enum_type parse(const xtd::string &str)
Converts the string to its enum_type equivalent.
Definition enum_object.hpp:227