source:
downloads/boost_1_34_1/libs/mpl/doc/src/refmanual/identity.rst
@
29
Last change on this file since 29 was 29, checked in by landauf, 17 years ago | |
---|---|
File size: 1.5 KB |
identity
Synopsis
template< typename X > struct identity { typedef X type; };
Description
The identity metafunction. Returns X unchanged.
Header
#include <boost/mpl/identity.hpp>
Model of
Parameters
Parameter | Requirement | Description |
---|---|---|
X | Any type | An argument to be returned. |
Expression semantics
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. |
Example
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 > ));
See also
|Metafunctions|, |Placeholders|, |Trivial Metafunctions|, |always|, |apply|
Note: See TracBrowser
for help on using the repository browser.