|
BDE 4.14.0 Production release
|
Provide a meta-function to transform pointer type to referent type.
This component defines a meta-function, bsl::remove_pointer, that may be used to obtain the type pointed to by a pointer type.
bsl::remove_pointer and bsl::remove_pointer_t meet the requirements of the remove_pointer template defined in the C++11 standard [meta.trans.ptr].
In this section we show intended use of this component.
Suppose that we want to get the type pointed to by a pointer type.
First, we create two typedefs – a pointer type (MyPtrType) and the type pointed to by the pointer type (MyType):
Now, we get the type pointed to by MyPtrType using bsl::remove_pointer and verify that the resulting type is the same as MyType:
Finally, if the current compiler supports alias templates C++11 feature, we get the type pointed to by MyPtrType using bsl::remove_pointer_t and verify that the resulting type is the same as MyType:
Note, that the bsl::remove_pointer_t avoids the ::type suffix and typename prefix when we want to use the result of the bsl::remove_pointer meta-function in templates.