source:
downloads/boost_1_34_1/libs/mpl/doc/src/refmanual/arg.rst
@
29
| Last change on this file since 29 was 29, checked in by landauf, 17 years ago | |
|---|---|
| File size: 1.9 KB | |
arg
Synopsis
template< int n > struct arg;
template<> struct arg<1>
{
template< typename A1,|...| typename An = |unspecified| >
struct apply
{
typedef A1 type;
};
};
|...|
template<> struct arg<n>
{
template< typename A1,|...| typename An >
struct apply
{
typedef An type;
};
};
Description
arg<n> specialization is a |Metafunction Class| that return the nth of its arguments.
Header
#include <boost/mpl/arg.hpp>
Parameters
| Parameter | Requirement | Description |
|---|---|---|
| n | An integral constant | A number of argument to return. |
Expression semantics
For any integral constant n in the range [1, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|] and arbitrary types |a1...an|:
typedef apply_wrapn< arg<n>,a1,|...|an >::type x;
| Return type: | A type. |
|---|---|
| Semantics: | x is identical to an. |
Example
typedef apply_wrap5< arg<1>,bool,char,short,int,long >::type t1; typedef apply_wrap5< arg<3>,bool,char,short,int,long >::type t3; BOOST_MPL_ASSERT(( is_same< t1, bool > )); BOOST_MPL_ASSERT(( is_same< t3, short > ));
Note: See TracBrowser
for help on using the repository browser.










