...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Metafunctions / Miscellaneous / identity |
The identity metafunction. Returns X unchanged.
#include <boost/mpl/identity.hpp>
Parameter | Requirement | Description |
---|---|---|
X | Any type | An argument to be returned. |
For an arbitrary type x:
typedef identity<x>::type r;
Return type: | A type. |
---|---|
Semantics: | Equivalent to typedef x r; |
Postcondition: | is_same<r,x>::value == true. |
typedef apply< identity<_1>, char >::type t1; typedef apply< identity<_2>, char,int >::type t2; BOOST_MPL_ASSERT(( is_same< t1, char > )); BOOST_MPL_ASSERT(( is_same< t2, int > ));