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

📄 at_c.rst

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

at_c
====

Synopsis
--------

.. parsed-literal::
    
    template<
          typename Sequence
        , long n
        >
    struct at_c
    {
        typedef |unspecified| type;
    };



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

Returns a type identical to the ``n``\ th element from the beginning of 
the sequence. ``at_c<Sequence,n>::type`` is a shorcut notation for 
``at< Sequence, long_<n> >::type``.


Header
------

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



Parameters
----------

+---------------+-----------------------------------+-----------------------------------------------+
| Parameter     | Requirement                       | Description                                   |
+===============+===================================+===============================================+
| ``Sequence``  | |Forward Sequence|                | A sequence to be examined.                    |
+---------------+-----------------------------------+-----------------------------------------------+
| ``n``         | A compile-time integral constant  | An offset from the beginning of the sequence  |
|               |                                   | specifying the element to be retrieved.       |
+---------------+-----------------------------------+-----------------------------------------------+


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


.. parsed-literal::

    typedef at_c<Sequence,n>::type t; 

:Return type:
    A type 

:Precondition:
    ``0 <= n < size<Sequence>::value`` 

:Semantics:
    Equivalent to 
    
    .. parsed-literal::

       typedef at< Sequence, long_<n> >::type t;


Complexity
----------

+-------------------------------+-----------------------------------+
| Sequence archetype            | Complexity                        |
+===============================+===================================+
| |Forward Sequence|            | Linear.                           |
+-------------------------------+-----------------------------------+
| |Random Access Sequence|      | Amortized constant time.          |
+-------------------------------+-----------------------------------+


Example
-------

.. parsed-literal::
    
    typedef range_c<long,10,50> range;
    BOOST_MPL_ASSERT_RELATION( (at_c< range,0 >::type::value), ==, 10 );
    BOOST_MPL_ASSERT_RELATION( (at_c< range,10 >::type::value), ==, 20 );
    BOOST_MPL_ASSERT_RELATION( (at_c< range,40 >::type::value), ==, 50 );


See also
--------

|Forward Sequence|, |Random Access Sequence|, |at|, |front|, |back|

⌨️ 快捷键说明

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