Back to Arangodb

identity

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/identity.html

3.12.9.12.2 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Metafunctions / Miscellaneous / identity |

identity

Synopsis

template<
      typename X
    >
struct[identity](./identity.html){
    typedef X type;
};

Description

The identity metafunction. Returns X unchanged.

#include <[boost/mpl/identity.hpp](../../../../boost/mpl/identity.hpp)>

Model of

Metafunction

Parameters

ParameterRequirementDescription
XAny typeAn argument to be returned.

Expression semantics

For an arbitrary type x:

typedef[identity](./identity.html)<x>::type r;

| Return type: |

A type.

| | Semantics: |

Equivalent to

typedef x r;

| | Postcondition: |

is_same<r,x>::value == true.

|

Example

typedef[apply](./apply.html)<[identity](./identity.html)<[\_1](./placeholders.html)>, char >::type t1;
typedef[apply](./apply.html)<[identity](./identity.html)<[\_2](./placeholders.html)>, char,int >::type t2;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same< t1, char > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same< t2, int > ));

See also

Metafunctions, Placeholders, Trivial Metafunctions, always, apply

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |