Shows how to use format xtd::parse<enum> method with enum values.
#include <xtd/console>
#include <xtd/enum>
#include <xtd/parse>
monday,
tuesday,
wednesday,
thursday,
friday,
saturday,
sunday
);
auto main() -> int {
auto wd1 = parse<week_day>("wednesday");
console::write_line(wd1);
console::write_line(wd2);
auto wd3 = parse<week_day>("2");
console::write_line(wd3);
try {
auto wd4 = parse<week_day>("january");
console::write_line(wd4);
console::write_line("Exception : {}", e.message());
}
}
Provides the base class for enumerations.
Definition enum_object.hpp:42
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
#define enum_(namespace_name, enum_t,...)
Provides the registration struct for enum.
Definition enum.hpp:52
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10