5#if !defined(__XTD_CORE_INTERNAL__)
6#error "Do not include this file: Internal use only"
13 template<
class type_t,
class bool_t>
14 struct __enum_any_object__ {};
16 template<
class type_t>
17 struct __enum_any_object__<type_t, std::true_type> {
18 auto operator()(
const any_object& o)
const -> type_t {
return as<enum_object<type_t>>(
o.value());}
21 template<
class type_t>
22 struct __enum_any_object__<type_t, std::false_type> {
26 template<
class type_t,
class bool_t>
27 struct __polymorphic_any_object__ {};
29 template<
class type_t>
30 struct __polymorphic_any_object__<type_t, std::true_type> {
31 auto operator()(
const any_object& o)
const -> type_t {
return as<type_t>(
o.value());}
34 template<
class type_t>
35 struct __polymorphic_any_object__<type_t, std::false_type> {
36 auto operator()(
const any_object& o)
const -> type_t {
return __enum_any_object__<type_t, typename std::is_enum<type_t>::type> {}(
o);}
58 template<
class type_t>
61 return __polymorphic_any_object__<type_t, typename std::is_polymorphic<type_t>::type> {}(
o);
82 template<
class type_t>
85 return __polymorphic_any_object__<type_t, typename std::is_polymorphic<type_t>::type> {}(
o);
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
static string to_string(xtd::any value)
Convert xtd::any to string.
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
@ invalid_cast
The cast is not valid.
Definition exception_case.hpp:63
auto as(any_object &o) -> type_t
Casts a type into another type.
Definition __as_any_object.hpp:59
bool is(xtd::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:484
auto as< string >(xtd::any_object &value) -> string
Casts a type into another type.
Definition __as_any_object.hpp:107
@ o
The O key.
Definition console_key.hpp:116
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Represents a boxed object.
Definition box.hpp:56