Provide an integral-constant-to-type conversion.
More...
Detailed Description
- Outline
-
-
- Purpose:
- Provide an integral-constant-to-type conversion.
-
- Classes:
-
-
- Macros:
-
- Description:
- This component defines a simple template structure used to map an integral constant to a C++ type.
bslmf::Tag<unsigned>
defines a different type for each distinct compile-time constant integral parameter. That is, instantiations with different integer values form distinct types, so that bslmf::Tag<0>
is a distinct type from bslmf::Tag<1>
, which, in turn, is also distinct from bslmf::Tag<2>
, and so on.
- This component also provides two macros for mapping a
bslmf::Tag<t_N>
instance to the integral value t_N
(BSLMF_TAG_TO_INT
), and to the boolean value t_N != 0
(BSLMF_TAG_TO_BOOL
).
-
- Macro Summary:
- This section provides a brief description of the macros defined in this component.
BSLMF_TAG_TO_INT(EXPR)
Given an integral value,
V
, and an expression,
EXPR
, of type
bslmf::Tag<V>
, this macro returns a compile-time constant with the value
V
.
EXPR
is not evaluated at run-time.
BSLMF_TAG_TO_BOOL(EXPR)
Given an integral value,
V
, and an expression,
EXPR
, of type
bslmf::Tag<V>
, this macro returns a compile-time constant with the value
true
or
false
, depending on the boolean value of
V
.
EXPR
is not evaluated at run-time.
Define Documentation
#define BSLMF_TAG_TO_UINT |
( |
|
BSLMF_EXPR |
) |
|
Value:(((sizeof(BSLMF_EXPR.d_upperSizeArray) - 1) << 16) \
| (sizeof(BSLMF_EXPR.d_lowerSizeArray) - 1))
#define BSLMF_TAG_TO_INT |
( |
|
BSLMF_EXPR |
) |
((int)BSLMF_TAG_TO_UINT(BSLMF_EXPR)) |
#define BSLMF_TAG_TO_BOOL |
( |
|
BSLMF_EXPR |
) |
(BSLMF_TAG_TO_INT(BSLMF_EXPR) != 0) |