13template<
typename new_type_t,
typename current_type_t>
14new_type_t* __convert_value__(current_type_t* value);
45 template<
typename new_type_t,
typename current_type_t>
46 static const new_type_t*
to_ptr(
const current_type_t* value) {
47 if (value ==
nullptr)
return nullptr;
48 return &to_ref<new_type_t>(*value);
62 template<
typename new_type_t,
typename current_type_t>
63 static new_type_t*
to_ptr(current_type_t* value) {
64 if (value ==
nullptr)
return nullptr;
65 return &to_ref<new_type_t>(*value);
79 template<
typename new_type_t,
typename current_type_t>
80 static const new_type_t*
to_ptr(
const current_type_t& value) {
81 return &to_ref<new_type_t>(value);
95 template<
typename new_type_t,
typename current_type_t>
96 static new_type_t*
to_ptr(current_type_t& value) {
97 return &to_ref<new_type_t>(value);
112 template<
typename new_type_t,
typename current_type_t>
113 static const new_type_t&
to_ref(
const current_type_t& value) {
115 return dynamic_cast<const new_type_t&
>(value);
116 }
catch (
const std::exception&
e) {
134 template<
typename new_type_t,
typename current_type_t>
135 static new_type_t&
to_ref(current_type_t& value) {
137 return dynamic_cast<new_type_t&
>(value);
138 }
catch (
const std::exception&
e) {
156 template<
typename new_type_t,
typename current_type_t>
157 static const new_type_t&
to_ref(
const current_type_t* value) {
160 return dynamic_cast<const new_type_t&
>(*value);
161 }
catch (
const std::exception&
e) {
179 template<
typename new_type_t,
typename current_type_t>
180 static new_type_t&
to_ref(current_type_t* value) {
183 return dynamic_cast<new_type_t&
>(*value);
184 }
catch (
const std::exception&
e) {
202 template<
typename new_type_t,
typename current_type_t>
204 auto ptr = value.release();
207 }
catch (
const std::exception&
e) {
225 template<
typename new_type_t,
typename current_type_t>
227 auto ptr = value.release();
230 }
catch (
const std::exception&
e) {
249 template<
typename new_type_t,
typename current_type_t>
252 unused_(
dynamic_cast<new_type_t&
>(*value.get()));
253 }
catch (
const std::exception&
e) {
256 return std::dynamic_pointer_cast<new_type_t>(value);
270 template<
typename new_type_t,
typename current_type_t>
273 unused_(
dynamic_cast<new_type_t&
>(*value.get()));
274 }
catch (
const std::exception&
e) {
277 return std::dynamic_pointer_cast<new_type_t>(value);
292 template<
typename new_type_t,
typename current_type_t>
295 unused_(
dynamic_cast<new_type_t&
>(*value.get()));
296 }
catch (
const std::exception&
e) {
300 return std::dynamic_pointer_cast<new_type_t>(std::move(value));
Contains std::any type and std::bad_any_cast exception.
Contains xtd::argument_null_exception exception.
The exception that is thrown when one of the arguments provided to a method is null.
Definition argument_null_exception.hpp:23
Represents API to convert pointers.
Definition convert_pointer.hpp:30
The exception that is thrown for invalid casting or explicit conversion.
Definition invalid_cast_exception.hpp:19
#define unused_
It may be used to suppress the "unused variable" or "unused local typedefs" compiler warnings when th...
Definition unused.hpp:30
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
static const new_type_t * to_ptr(const current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:80
static const new_type_t * to_ptr(const current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:46
static new_type_t & to_ref(current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:180
static xtd::uptr< new_type_t > to_unique_ptr(xtd::uptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:226
static new_type_t * to_ptr(current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:96
static xtd::sptr< new_type_t > to_shared_ptr(xtd::sptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:293
static xtd::sptr< new_type_t > to_shared_ptr(const xtd::sptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:250
static new_type_t * to_ptr(current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:63
static const new_type_t & to_ref(const current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:113
static xtd::uptr< new_type_t > to_unique_ptr(xtd::uptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:203
static const new_type_t & to_ref(const current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:157
static xtd::sptr< new_type_t > to_shared_ptr(xtd::sptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:271
static new_type_t & to_ref(current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:135
Contains xtd::invalid_cast_exception exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::static_object class.
Contains unused_ keyword.
Contains xtd fundamental types.