|
BDE 4.14.0 Production release
|
Provide a meta-function for removing volatile-qualifier.
volatile-qualifierThis component defines a meta-function, bsl::remove_volatile and declares an bsl::remove_volatile_t alias to the return type of the bsl::remove_volatile, that may be used to remove any top-level volatile-qualifier from a type.
bsl::remove_volatile and bsl::remove_volatile_t meet the requirements of the remove_volatile template defined in the C++11 standard [meta.trans.cv].
In this section we show intended use of this component.
Suppose that we want to remove any volatile-qualifier from a particular type.
First, we create two typedefs – a volatile-qualified type (MyVolatileType) and the same type without the volatile-qualifier (MyType):
Now, we remove the volatile-qualifier from MyVolatileType using bsl::remove_volatile and verify that the resulting type is the same as MyType:
Finally, if the current compiler supports alias templates C++11 feature, we remove a volatile-qualifier from MyVolatileType using bsl::remove_volatile_t and verify that the resulting type is the same as MyType:
Note, that the bsl::remove_volatile_t avoids the ::type suffix and typename prefix when we want to use the result of the bsl::remove_const meta-function in templates.