always.rst

来自「Boost provides free peer-reviewed portab」· RST 代码 · 共 93 行

RST
93
字号
.. Metafunctions/Miscellaneous//always |20.. 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)always======Synopsis--------.. parsed-literal::        template<           typename X        >    struct always    {        // |unspecified|        // |...|    };Description-----------``always<X>`` specialization is a variadic |Metafunction Class| always returning the same type, ``X``, regardless of the number and types of passed arguments.Header------.. parsed-literal::        #include <boost/mpl/always.hpp>Model of--------|Metafunction Class|Parameters----------+---------------+-------------------+-----------------------------------+| Parameter     | Requirement       | Description                       |+===============+===================+===================================+| ``X``         | Any type          | A type to be returned.            |+---------------+-------------------+-----------------------------------+Expression semantics--------------------For an arbitrary type ``x``:.. parsed-literal::    typedef always<x> f;:Return type:    |Metafunction Class|.:Semantics:    Equivalent to        .. parsed-literal::            struct f : bind< identity<_1>, x > {};Example-------.. parsed-literal::        typedef always<true\_> always_true;    BOOST_MPL_ASSERT(( apply< always_true,false\_> ));    BOOST_MPL_ASSERT(( apply< always_true,false\_,false\_ > ));    BOOST_MPL_ASSERT(( apply< always_true,false\_,false\_,false\_ > ));See also--------|Metafunctions|, |Metafunction Class|, |identity|, |bind|, |apply|

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?