6#if !defined(__XTD_CORE_INTERNAL__)
7#error "Do not include this file: Internal use only"
29 template<
class new_type,
class current_type>
30 [[nodiscard]]
auto as(
const current_type& value) ->
const new_type& {
31 thread_local static __as_enum__<new_type, current_type, typename std::is_enum<current_type>::type>
e;
32 return e.convert(value);
51 template<
class new_type,
class current_type>
52 requires (!std::is_null_pointer_v<new_type>)
53 [[nodiscard]]
auto as(current_type& value) -> new_type& {
54 thread_local static __as_enum__<new_type, current_type, typename std::is_enum<current_type>::type>
e;
55 return e.convert(value);
59 template<
class new_type,
class current_type>
60 requires std::is_null_pointer_v<new_type>
61 [[nodiscard]]
auto as(current_type& value) -> new_type& {
82 template<
class new_type,
class current_type>
83 [[nodiscard]]
inline auto as(
const current_type* value) ->
const new_type* {
102 template<
class new_type,
class current_type>
103 [[nodiscard]]
auto as(current_type* value) -> new_type* {
123 template<
class new_type,
class current_type>
143 template<
class new_type,
class current_type>
164 template<
class new_type,
class current_type>
184 template<
class new_type,
class current_type>
205 template<
class new_type,
class current_type>
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
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
static xtd::uptr< new_type > to_unique_ptr(xtd::uptr< current_type > &value)
Casts a type into another type.
Definition convert_pointer.hpp:368
static const new_type * to_ptr(const current_type *value)
Casts a type into another type.
Definition convert_pointer.hpp:45
auto as(any_object &o) -> type_t
Casts a type into another type.
Definition __as_any_object.hpp:60
static xtd::sptr< new_type > to_shared_ptr(const xtd::sptr< current_type > &value)
Casts a type into another type.
Definition convert_pointer.hpp:252
@ e
The E key.
Definition console_key.hpp:96
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8