Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work

源代码在线查看: arg.rst

软件大小: 35482 K
上传用户: sinba
关键词: libraries peer-reviewed emphasize provides
下载地址: 免注册下载 普通下载 VIP

相关代码

				.. Metafunctions/Composition and Argument Binding//arg |50								.. Copyright Aleksey Gurtovoy, David Abrahams 2007.				.. 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)								arg				===								Synopsis				--------								.. parsed-literal::				   				    template< int n > struct arg;								    template struct arg				    {				        template< typename A1,\ |...| typename A\ *n* = |unspecified| >				        struct apply				        {				            typedef A1 type;				        };				    };								    |...|								    template struct arg				    {				        template< typename A1,\ |...| typename A\ *n* >				        struct apply				        {				            typedef A\ *n* type;				        };				    };												Description				-----------								``arg`` specialization is a |Metafunction Class| that return the ``n``\ th of its arguments.												Header				------								.. parsed-literal::				    				    #include 												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|:								.. parsed-literal::								    typedef apply_wrap\ *n*\< arg,a1,\ |...|\a\ *n* >::type x;								:Return type:				    A type.								:Semantics:				    ``x`` is identical to ``an``.												Example				-------								.. parsed-literal::								    typedef apply_wrap\ ``5``\< arg,bool,char,short,int,long >::type t1;				    typedef apply_wrap\ ``5``\< arg,bool,char,short,int,long >::type t3;				    				    BOOST_MPL_ASSERT(( is_same< t1, bool > ));				    BOOST_MPL_ASSERT(( is_same< t3, short > ));												See also				--------								|Composition and Argument Binding|, |Placeholders|, |lambda|, |bind|, |apply|, |apply_wrap|							

相关资源