12template<
class new_type_t,
class current_type_t>
13new_type_t* __convert_value__(current_type_t* value);
44 template<
class new_type_t,
class current_type_t>
45 static const new_type_t*
to_ptr(
const current_type_t* value) {
46 if (value ==
nullptr)
return nullptr;
61 template<
class new_type_t,
class current_type_t>
62 static new_type_t*
to_ptr(current_type_t* value) {
63 if (value ==
nullptr)
return nullptr;
78 template<
class new_type_t,
class current_type_t>
79 static const new_type_t*
to_ptr(
const current_type_t& value) {
94 template<
class new_type_t,
class current_type_t>
95 static new_type_t*
to_ptr(current_type_t& value) {
111 template<
class new_type_t,
class current_type_t>
127 template<
class new_type_t,
class current_type_t>
144 template<
class new_type_t,
class current_type_t>
161 template<
class new_type_t,
class current_type_t>
162 static const new_type_t&
to_ref(
const current_type_t& value) {
164 return dynamic_cast<const new_type_t&
>(value);
165 }
catch (
const std::exception&
e) {
183 template<
class new_type_t,
class current_type_t>
184 static new_type_t&
to_ref(current_type_t& value) {
186 return dynamic_cast<new_type_t&
>(value);
187 }
catch (
const std::exception&
e) {
205 template<
class new_type_t,
class current_type_t>
206 static const new_type_t&
to_ref(
const current_type_t* value) {
209 return dynamic_cast<const new_type_t&
>(*value);
210 }
catch (
const std::exception&
e) {
228 template<
class new_type_t,
class current_type_t>
229 static new_type_t&
to_ref(current_type_t* value) {
232 return dynamic_cast<new_type_t&
>(*value);
233 }
catch (
const std::exception&
e) {
251 template<
class new_type_t,
class current_type_t>
254 [[maybe_unused]]
auto result =
dynamic_cast<new_type_t&
>(*value.get());
255 }
catch (
const std::exception&
e) {
258 return std::dynamic_pointer_cast<new_type_t>(value.pointer());
272 template<
class new_type_t,
class current_type_t>
275 [[maybe_unused]]
auto& result =
dynamic_cast<new_type_t&
>(*value.get());
276 }
catch (
const std::exception&
e) {
279 return std::dynamic_pointer_cast<new_type_t>(value.pointer());
294 template<
class new_type_t,
class current_type_t>
297 [[maybe_unused]]
auto& result =
dynamic_cast<new_type_t&
>(*value.get());
298 }
catch (
const std::exception&
e) {
302 return std::dynamic_pointer_cast<new_type_t>(std::move(value.pointer()));
317 template<
class new_type_t,
class current_type_t>
333 template<
class new_type_t,
class current_type_t>
350 template<
class new_type_t,
class current_type_t>
367 template<
class new_type_t,
class current_type_t>
369 auto ptr = value.release();
372 }
catch (
const std::exception&
e) {
390 template<
class new_type_t,
class current_type_t>
392 auto ptr = value.release();
395 }
catch (
const std::exception&
e) {
414 template<
class new_type_t,
class current_type_t>
430 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:29
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
@ argument_null
The argument is null.
Definition exception_case.hpp:33
#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:79
static const new_type_t * to_ptr(const current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:45
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:318
static xtd::sptr< new_type_t > to_sptr(xtd::sptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:351
static new_type_t & to_ref(current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:229
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:391
static new_type_t * to_ptr(current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:95
static xtd::ptr< new_type_t > to_ptr(xtd::ptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:145
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:295
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:252
static xtd::sptr< new_type_t > to_sptr(xtd::sptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:334
static new_type_t * to_ptr(current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:62
static const new_type_t & to_ref(const current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:162
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:368
static const new_type_t & to_ref(const current_type_t *value)
Casts a type into another type.
Definition convert_pointer.hpp:206
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:273
static new_type_t & to_ref(current_type_t &value)
Casts a type into another type.
Definition convert_pointer.hpp:184
static xtd::uptr< new_type_t > to_uptr(xtd::uptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:415
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:112
static xtd::uptr< new_type_t > to_uptr(xtd::uptr< current_type_t > &&value)
Casts a type into another type.
Definition convert_pointer.hpp:431
static xtd::ptr< new_type_t > to_ptr(xtd::ptr< current_type_t > &value)
Casts a type into another type.
Definition convert_pointer.hpp:128
@ 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.