#include <xtd/xtd>
struct foo1 {
int value = 0;
};
auto operator <<(std::ostream& os, const foo1& f) noexcept -> std::ostream& {return os << f.value;}
struct foo2 {
};
template<>
struct foo3 : public istringable<foo3> {
explicit foo3(
int v) :
value {
v} {}
auto to_string() const noexcept ->
string override {
return string::format(
"{}", value);}
};
auto main() -> int {
if (is<string>(a)) console::write_line("a = {} => {} ({})", a, as<string>(a).to_title_case(), type_of(as<string>(a)));
if (is<date_time>(a)) console::write_line("a = {} => {} ({})", a, as<date_time>(a).to_short_date_string(), type_of(as<date_time>(a)));
if (is<int32>(a)) console::write_line("a = {} => {} ({})", a, as<int32>(a), type_of(as<int32>(a)));
if (is<double>(a)) console::write_line("a = {} => {} ({})", a, as<double>(a), type_of(as<double>(a)));
if (is<foo1>(a)) console::write_line("a = {} => {} ({})", a, as<foo1>(a), type_of(as<foo1>(a)));
if (is<foo2>(a)) console::write_line("a = {} => {} ({})", a, as<foo2>(a), type_of(as<foo2>(a)));
if (is<foo3>(a)) console::write_line("a = {} => {} ({})", a, as<foo3>(a), type_of(as<foo3>(a)));
a = day_of_week::wednesday;
if (is<day_of_week>(a)) console::write_line("a = {} => {} ({})", a, as<day_of_week>(a), type_of(as<day_of_week>(a)));
}
@ date_time
Write the date and time.
Definition trace_options.hpp:31
@ value
Represnets the constant operator precedence (42).
Definition operator_precedence.hpp:30
box_integer< int32 > int32_object
Represent a boxed int32.
Definition int32_object.hpp:29
@ a
The A key.
Definition console_key.hpp:88
@ v
The V key.
Definition console_key.hpp:130
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.