• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Metafunctions/Miscellaneous//min |80
2
3min
4===
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename N1
13        , typename N2
14        >
15    struct min
16    {
17        typedef |unspecified| type;
18    };
19
20
21
22Description
23-----------
24
25Returns the smaller of its two arguments.
26
27
28Header
29------
30
31.. parsed-literal::
32
33    #include <boost/mpl/min_max.hpp>
34
35
36Model of
37--------
38
39|Metafunction|
40
41
42Parameters
43----------
44
45+---------------+-------------------+-------------------------------------------+
46| Parameter     | Requirement       | Description                               |
47+===============+===================+===========================================+
48| ``N1``, ``N2``| Any type          | Types to compare.                         |
49+---------------+-------------------+-------------------------------------------+
50
51
52Expression semantics
53--------------------
54
55For arbitrary types ``x`` and ``y``:
56
57
58.. parsed-literal::
59
60    typedef min<x,y>::type r;
61
62
63:Return type:
64    A type.
65
66:Precondition:
67    ``less<x,y>::value`` is a well-formed integral constant expression.
68
69:Semantics:
70    Equivalent to
71
72    .. parsed-literal::
73
74        typedef if_< less<x,y>,x,y >::type r;
75
76
77
78Complexity
79----------
80
81Constant time.
82
83
84Example
85-------
86
87.. parsed-literal::
88
89    typedef fold<
90          vector_c<int,1,7,0,-2,5,-1>
91        , int_<-10>
92        , min<_1,_2>
93        >::type r;
94
95    BOOST_MPL_ASSERT(( is_same< r, int_<-10> > ));
96
97
98See also
99--------
100
101|Metafunctions|, |Comparison|, |max|, |less|, |min_element|
102
103
104.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
105   Distributed under the Boost Software License, Version 1.0. (See accompanying
106   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
107