⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 front.rst

📁 C++的一个好库。。。现在很流行
💻 RST
字号:
.. Sequences/Intrinsic Metafunctions//front

front
=====

Synopsis
--------

.. parsed-literal::
    
    template<
          typename Sequence
        >
    struct front
    {
        typedef |unspecified| type;
    };



Description
-----------

Returns the first element in the sequence.


Header
------

.. parsed-literal::
    
    #include <boost/mpl/front.hpp>


Model of
--------

|Tag Dispatched Metafunction|


Parameters
----------

+---------------+-----------------------+-----------------------------------------------+
| Parameter     | Requirement           | Description                                   |
+===============+=======================+===============================================+
| ``Sequence``  | |Forward Sequence|    | A sequence to be examined.                    |
+---------------+-----------------------+-----------------------------------------------+


Expression semantics
--------------------

For any |Forward Sequence| ``s``:


.. parsed-literal::

    typedef front<s>::type t; 

:Return type:
    A type.

:Precondition:
    ``empty<s>::value == false``.

:Semantics:
    Equivalent to 

    .. parsed-literal::
        
       typedef deref< begin<s>::type >::type t;



Complexity
----------

Amortized constant time.


Example
-------

.. parsed-literal::
    
    typedef list<long>::type types1;
    typedef list<int,long>::type types2;
    typedef list<char,int,long>::type types3;
    
    BOOST_MPL_ASSERT(( is_same< front<types1>::type, long > ));
    BOOST_MPL_ASSERT(( is_same< front<types2>::type, int> ));
    BOOST_MPL_ASSERT(( is_same< front<types3>::type, char> ));



See also
--------

|Forward Sequence|, |back|, |push_front|, |begin|, |deref|, |at|

⌨️ 快捷键说明

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