System::ExplicitCast 方法

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于在源类型和结果类型相同的情况下。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::None, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于需要简单的类似构造函数的转换时。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Static, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于异常包装器。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Exception, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于将对象转换为异常。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::ObjectToException, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于当源和结果都是智能指针且结果类型中没有显式的 SmartPtr<…> 时。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Pointer, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于当源和结果都是智能指针且结果类型中带有显式的 SmartPtr<…> 时。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::PointerToPointer, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于将对象拆箱为可空类型。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::UnboxingToNullable, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于对可空类型进行装箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::NullableBoxing, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于对可空对象进行拆箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::NullableUnboxing, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于枚举装箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::EnumBoxing, SmartPtr<BoxedValueBase>> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于在需要将值类型作为智能指针引用时,将值类型复制到堆上(在受接口类型约束但使用实现该接口的结构体特化的泛型中)。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::HeapifyBoxing, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于从值类型获取接口。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::InterfaceBoxing, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于常规装箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Boxing, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于对 System::String 进行装箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::StringBoxing, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于接口拆箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::InterfaceUnboxing, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于常规拆箱。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Unboxing, Result> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于 nullptr 转换。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Null, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(const Source&) method

使用显式转换将源类型转换为结果类型。用于数组之间的转换。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::Array, typename CastResult<Result>::type> System::ExplicitCast(const Source &value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueconst Source&要转换的 Object

ReturnValue

转换结果。

另见

System::ExplicitCast(Source) method

使用显式转换将源类型转换为结果类型。用于将原始指针转换为智能指针时。

template<typename Result,typename Source> std::enable_if_t<Details::CastType<Source, Result>::RawPointer, typename CastResult<std::remove_pointer_t<Result>>::type> System::ExplicitCast(Source value)
参数描述
源类型。
Result结果类型。
参数类型描述
valueSource要转换的 Object

ReturnValue

转换结果。

另见