Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

updated boost from 1_33_1 to 1_34_1

File size: 1.5 KB

identity

Synopsis

template<
      typename X
    >
struct identity
{
    typedef X type;
};

Description

The identity metafunction. Returns X unchanged.

Model of

|Metafunction|

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 > ));

Docutils System Messages

??????
Note: See TracBrowser for help on using the repository browser.