13template<
class new_type_t,
class current_type_t>
14new_type_t* __convert_value__(current_type_t* value);
45 template<
class new_type_t,
class current_type_t>
46 static const new_type_t*
to_ptr(
const current_type_t* value) {
47 if (value ==
nullptr)
return nullptr;
46 static const new_type_t*
to_ptr(
const current_type_t* value) {
…}
62 template<
class new_type_t,
class current_type_t>
63 static new_type_t*
to_ptr(current_type_t* value) {
64 if (value ==
nullptr)
return nullptr;
63 static new_type_t*
to_ptr(current_type_t* value) {
…}
79 template<
class new_type_t,
class current_type_t>
80 static const new_type_t*
to_ptr(
const current_type_t& value) {
80 static const new_type_t*
to_ptr(
const current_type_t& value) {
…}
95 template<
class new_type_t,
class current_type_t>
96 static new_type_t*
to_ptr(current_type_t& value) {
96 static new_type_t*
to_ptr(current_type_t& value) {
…}
112 template<
class new_type_t,
class current_type_t>
128 template<
class new_type_t,
class current_type_t>
145 template<
class new_type_t,
class current_type_t>
162 template<
class new_type_t,
class current_type_t>
163 static const new_type_t&
to_ref(
const current_type_t& value) {
165 return dynamic_cast<const new_type_t&
>(value);
166 }
catch (
const std::exception&
e) {
163 static const new_type_t&
to_ref(
const current_type_t& value) {
…}
184 template<
class new_type_t,
class current_type_t>
185 static new_type_t&
to_ref(current_type_t& value) {
187 return dynamic_cast<new_type_t&
>(value);
188 }
catch (
const std::exception&
e) {
185 static new_type_t&
to_ref(current_type_t& value) {
…}
206 template<
class new_type_t,
class current_type_t>
207 static const new_type_t&
to_ref(
const current_type_t* value) {
210 return dynamic_cast<const new_type_t&
>(*value);
211 }
catch (
const std::exception&
e) {
207 static const new_type_t&
to_ref(
const current_type_t* value) {
…}
229 template<
class new_type_t,
class current_type_t>
230 static new_type_t&
to_ref(current_type_t* value) {
233 return dynamic_cast<new_type_t&
>(*value);
234 }
catch (
const std::exception&
e) {
230 static new_type_t&
to_ref(current_type_t* value) {
…}
252 template<
class new_type_t,
class current_type_t>
255 unused_(
dynamic_cast<new_type_t&
>(*value.get()));
256 }
catch (
const std::exception&
e) {
259 return std::dynamic_pointer_cast<new_type_t>(value.pointer());
273 template<
class new_type_t,
class current_type_t>
276 unused_(
dynamic_cast<new_type_t&
>(*value.get()));
277 }
catch (
const std::exception&
e) {
280 return std::dynamic_pointer_cast<new_type_t>(value.pointer());
295 template<
class new_type_t,
class current_type_t>
298 unused_(
dynamic_cast<new_type_t&
>(*value.get()));
299 }
catch (
const std::exception&
e) {
303 return std::dynamic_pointer_cast<new_type_t>(std::move(value.pointer()));
318 template<
class new_type_t,
class current_type_t>
334 template<
class new_type_t,
class current_type_t>
351 template<
class new_type_t,
class current_type_t>
368 template<
class new_type_t,
class current_type_t>
370 auto ptr = value.release();
373 }
catch (
const std::exception&
e) {
391 template<
class new_type_t,
class current_type_t>
393 auto ptr = value.release();
396 }
catch (
const std::exception&
e) {
415 template<
class new_type_t,
class current_type_t>
431 template<
class new_type_t,
class current_type_t>
Contains xtd::any type and std::bad_any_cast exception.
Contains xtd::argument_null_exception exception.
Represents API to convert pointers.
Definition convert_pointer.hpp:30
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
@ invalid_cast
The cast is not valid.
Definition exception_case.hpp:61
@ argument_null
The argument is null.
Definition exception_case.hpp:33
#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::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
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
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 xtd::sptr< new_type_t > to_sptr(const xtd::sptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:319
static xtd::sptr< new_type_t > to_sptr(xtd::sptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:352
static new_type_t & to_ref(current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:230
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:392
static new_type_t * to_ptr(current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:96
static xtd::ptr< new_type_t > to_ptr(xtd::ptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:146
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:296
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:253
static xtd::sptr< new_type_t > to_sptr(xtd::sptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:335
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:163
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:369
static const new_type_t & to_ref(const current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:207
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:274
static new_type_t & to_ref(current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:185
static xtd::uptr< new_type_t > to_uptr(xtd::uptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:416
static xtd::ptr< new_type_t > to_ptr(const xtd::ptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:113
static xtd::uptr< new_type_t > to_uptr(xtd::uptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:432
static xtd::ptr< new_type_t > to_ptr(xtd::ptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:129
@ e
The E key.
Definition console_key.hpp:96
Contains xtd::invalid_cast_exception exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::static_object class.
Contains xtd fundamental types.
Contains unused_ keyword.