16 template<
typename value_t>
17 [[nodiscard]]
inline auto is(
bool value) ->
bool {
return false;}
18 template<
typename value_t>
19 [[nodiscard]]
inline auto is(
char value) ->
bool {
return false;}
20 template<
typename value_t>
21 [[nodiscard]]
inline auto is(
char16 value) ->
bool {
return false;}
22 template<
typename value_t>
23 [[nodiscard]]
inline auto is(
char32 value) ->
bool {
return false;}
24 template<
typename value_t>
25 [[nodiscard]]
inline auto is(
char8 value) ->
bool {
return false;}
26 template<
typename value_t>
27 [[nodiscard]]
inline auto is(
wchar value) ->
bool {
return false;}
28 template<
typename value_t>
29 [[nodiscard]]
inline auto is(
decimal value) ->
bool {
return false;}
30 template<
typename value_t>
31 [[nodiscard]]
inline auto is(
double value) ->
bool {
return false;}
32 template<
typename value_t>
33 [[nodiscard]]
inline auto is(
float value) ->
bool {
return false;}
34 template<
typename value_t>
35 [[nodiscard]]
inline auto is(
sbyte value) ->
bool {
return false;}
36 template<
typename value_t>
37 [[nodiscard]]
inline auto is(
int16 value) ->
bool {
return false;}
38 template<
typename value_t>
39 [[nodiscard]]
inline auto is(
int32 value) ->
bool {
return false;}
40 template<
typename value_t>
41 [[nodiscard]]
inline auto is(
int64 value) ->
bool {
return false;}
42 template<
typename value_t>
43 [[nodiscard]]
inline auto is(
slong value) ->
bool {
return false;}
44 template<
typename value_t>
45 [[nodiscard]]
inline auto is(
xtd::byte value) ->
bool {
return false;}
46 template<
typename value_t>
47 [[nodiscard]]
inline auto is(
uint16 value) ->
bool {
return false;}
48 template<
typename value_t>
49 [[nodiscard]]
inline auto is(
uint32 value) ->
bool {
return false;}
50 template<
typename value_t>
51 [[nodiscard]]
inline auto is(
uint64 value) ->
bool {
return false;}
52 template<
typename value_t>
53 [[nodiscard]]
inline auto is(
xtd::ulong value) ->
bool {
return false;}
74 [[nodiscard]]
inline auto is<bool>(
bool value) ->
bool {
96 [[nodiscard]]
inline auto is<char>(
char value) ->
bool {
250 [[nodiscard]]
inline auto is<float>(
float value) ->
bool {
484 template<
typename type_t>
489 }
catch (
const std::bad_cast&) {
497 return !value.has_value();
526 template<
typename type_t,
typename param_t>
527 [[nodiscard]]
auto is(
const param_t* value) ->
bool {
529 if (value ==
nullptr)
return false;
530 return dynamic_cast<const type_t*
>(value) !=
nullptr;
531 }
catch (
const std::bad_cast&) {
546 template<
typename type_t,
typename param_t>
547 [[nodiscard]]
auto is(
const param_t& value) ->
bool {
561 template<
typename type_t,
typename param_t>
562 requires (std::is_polymorphic_v<type_t> && std::is_polymorphic_v<param_t> && !std::is_null_pointer_v<type_t>)
563 [[nodiscard]]
auto is(param_t* value) ->
bool {
564 if (value ==
nullptr)
return false;
565 return dynamic_cast<type_t*
>(value) !=
nullptr;
569 template<
typename type_t,
typename param_t>
570 requires ((!std::is_polymorphic_v<type_t> || !std::is_polymorphic_v<param_t>) && !std::is_null_pointer_v<type_t>)
571 [[nodiscard]]
auto is(param_t* value) ->
bool {
572 if (value ==
nullptr)
return false;
573 return typeid(type_t).name() ==
typeid(param_t).name();
576 template<
typename type_t,
typename param_t>
577 requires std::is_null_pointer_v<type_t>
578 [[nodiscard]]
auto is(param_t* value) ->
bool {
579 return value ==
nullptr;
582 template<
typename type_t,
typename ...args_t>
583 [[nodiscard]]
inline auto is(
const std::variant<args_t...>& value) ->
bool {
585 std::visit([&](
auto&& arg) {
if constexpr (std::is_same_v<std::remove_cvref_t<std::decay_t<
decltype(
arg)>>, std::remove_cvref_t<type_t>>) result =
true;},
value);
589 template<
typename type_t,
typename ...args_t>
590 [[nodiscard]]
inline auto is(std::variant<args_t...>& value) ->
bool {
592 std::visit([&](
auto&& arg) {
if constexpr (std::is_same_v<std::remove_cvref_t<std::decay_t<
decltype(
arg)>>, std::remove_cvref_t<type_t>>) result =
true;},
value);
607 template<
typename type_t,
typename param_t>
608 [[nodiscard]]
auto is(param_t& value) ->
bool {
622 template<
typename new_type,
typename current_type>
624 auto result = std::dynamic_pointer_cast<new_type>(value.pointer());
625 if (result)
return true;
Contains xtd::any type and std::bad_any_cast exception.
constexpr xtd::expressions::placeholder< index > arg
The xtd::expressions::arg instance is the index argument used by expression.
Definition arg.hpp:61
@ value
Represnets the constant operator precedence (42).
Definition operator_precedence.hpp:30
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition slong.hpp:27
std::int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.hpp:23
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition ulong.hpp:27
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.hpp:23
std::uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::int16_t int16
Represents a 16-bit signed integer.
Definition int16.hpp:23
std::uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.hpp:23
std::uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
std::any any
Represents the any alias on std::any.
Definition any.hpp:24
auto is< sbyte >(sbyte value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:272
auto is< decimal >(decimal value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:206
auto is< uint16 >(uint16 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:404
auto is< xtd::any >(xtd::any value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:512
auto is< wchar >(wchar value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:184
auto is< char32 >(char32 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:140
auto any_cast(const xtd::any &operand) -> type_t
Performs type-safe access to the contained object.
Definition any_cast.hpp:22
auto is< int16 >(int16 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:294
auto is< double >(double value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:228
auto is< float >(float value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:250
auto is(xtd::any value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
auto is< int32 >(int32 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:316
auto is< uint32 >(uint32 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:426
auto is< xtd::byte >(xtd::byte value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:382
auto is< bool >(bool value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:74
auto is< char16 >(char16 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:118
auto is< slong >(slong value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:360
auto is< char8 >(char8 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:162
auto is< uint64 >(uint64 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:448
auto is< int64 >(int64 value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:338
auto is< xtd::ulong >(xtd::ulong value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:470
auto is< char >(char value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:96
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::parse methods.
Contains xtd fundamental types.