eval_if.rst
来自「Boost provides free peer-reviewed portab」· RST 代码 · 共 89 行
RST
89 行
.. Metafunctions/Type Selection//eval_if |30.. 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)eval_if=======Synopsis--------.. parsed-literal:: template< typename C , typename F1 , typename F2 > struct eval_if { typedef |unspecified| type; };Description-----------Evaluates one of its two |nullary metafunction| arguments, ``F1`` or ``F2``, depending on the value ``C``.Header------.. parsed-literal:: #include <boost/mpl/eval_if.hpp>Parameters----------+---------------+-----------------------------------+-----------------------------------------------+| Parameter | Requirement | Description |+===============+===================================+===============================================+| ``C`` | |Integral Constant| | An evaluation condition. |+---------------+-----------------------------------+-----------------------------------------------+| ``F1``, ``F2``| Nullary |Metafunction| | Metafunctions to select for evaluation from. |+---------------+-----------------------------------+-----------------------------------------------+Expression semantics--------------------For any |Integral Constant| ``c`` and nullary |Metafunction|\ s ``f1``, ``f2``:.. parsed-literal:: typedef eval_if<c,f1,f2>::type t;:Return type: Any type.:Semantics: If ``c::value == true``, ``t`` is identical to ``f1::type``; otherwise ``t`` is identical to ``f2::type``.Example-------.. parsed-literal:: typedef eval_if< true\_, identity<char>, identity<long> >::type t1; typedef eval_if< false\_, identity<char>, identity<long> >::type t2; BOOST_MPL_ASSERT(( is_same<t1,char> )); BOOST_MPL_ASSERT(( is_same<t2,long> ));See also--------|Metafunctions|, |Integral Constant|, |eval_if_c|, |if_|
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?