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

📄 min.rst

📁 C++的一个好库。。。现在很流行
💻 RST
字号:
.. Metafunctions/Miscellaneous//min |80

min
===

Synopsis
--------

.. parsed-literal::
    
    template<
          typename N1
        , typename N2
        >
    struct min
    {
        typedef |unspecified| type;
    };



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

Returns the smaller of its two arguments.


Header
------

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


Model of
--------

|Metafunction|


Parameters
----------

+---------------+-------------------+-------------------------------------------+
| Parameter     | Requirement       | Description                               |
+===============+===================+===========================================+
| ``N1``, ``N2``| Any type          | Types to compare.                         |
+---------------+-------------------+-------------------------------------------+


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

For arbitrary types ``x`` and ``y``:


.. parsed-literal::

    typedef min<x,y>::type r;


:Return type:
    A type.

:Precondition:
    ``less<x,y>::value`` is a well-formed integral constant expression.

:Semantics:
    Equivalent to
        
    .. parsed-literal::
    
        typedef if_< less<x,y>,x,y >::type r;



Complexity
----------

Constant time. 


Example
-------

.. parsed-literal::
    
    typedef fold<
          vector_c<int,1,7,0,-2,5,-1>
        , int_<-10>
        , min<_1,_2>
        >::type r;
    
    BOOST_MPL_ASSERT(( is_same< r, int_<-10> > ));


See also
--------

|Metafunctions|, |Comparison|, |max|, |less|, |min_element|

⌨️ 快捷键说明

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