Quick Links:

bal | bbl | bdl | bsl

Namespaces | Defines

Component bslmf_arraytopointer
[Package bslmf]

Provide a meta-function to convert array types to pointer types. More...

Namespaces

namespace  bslmf

Defines

#define bslmf_ArrayToConstPointer   bslmf::ArrayToConstPointer
#define bslmf_ArrayToPointer   bslmf::ArrayToPointer

Detailed Description

Outline
Purpose:
Provide a meta-function to convert array types to pointer types.
Classes:
bslmf::ArrayToPointer convert an array type to a pointer type
bslmf::ArrayToConstPointer convert an array type to a const pointer type
See also:
Component bslmf_isarray, Component bslmf_forwardingtype
Description:
This component provides a meta function for converting array types to pointer types. The utility is generally used for in templates that require forwarding or storage of arguments that are passed a arrays(e.g., "string literals"). For non array types, the type is left unmodified. Note that bslmf::ArrayToPointer and bslmf::ArrayToConstPointer retain the CV qualifiers of the original type. In other words, if the original array type was const or volatile, or const volatile, the converted pointer type will also be const, volatile, or const volatile respectively.
When an explicit const pointer pointer type is needed(such as when accepting as argument, then bslmf::ArrayToConstPointer should be used.
Usage:
For example:
  assert(1 == bsl::is_same<bslmf::ArrayToPointer<int[5]>::Type
                          , int *>::value);
  assert(1 == bsl::is_same<bslmf::ArrayToPointer<int *>::Type
                          , int *>::value);
  assert(0 == bsl::is_same<bslmf::ArrayToPointer<int (*)[5]>::Type]
                          , int **>::value);

Define Documentation

#define bslmf_ArrayToConstPointer   bslmf::ArrayToConstPointer
#define bslmf_ArrayToPointer   bslmf::ArrayToPointer