1.. Algorithms/Querying Algorithms//min_element |80 2 3min_element 4=========== 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename Sequence 13 , typename Pred = less<_1,_2> 14 > 15 struct min_element 16 { 17 typedef |unspecified| type; 18 }; 19 20 21 22Description 23----------- 24 25Returns an iterator to the smallest element in ``Sequence``. 26 27 28Header 29------ 30 31.. parsed-literal:: 32 33 #include <boost/mpl/min_element.hpp> 34 35 36Parameters 37---------- 38 39+---------------+-------------------------------+-----------------------------------+ 40| Parameter | Requirement | Description | 41+===============+===============================+===================================+ 42|``Sequence`` | |Forward Sequence| | A sequence to be searched. | 43+---------------+-------------------------------+-----------------------------------+ 44| ``Pred`` | Binary |Lambda Expression| | A comparison criteria. | 45+---------------+-------------------------------+-----------------------------------+ 46 47 48Expression semantics 49-------------------- 50 51For any |Forward Sequence| ``s`` and binary |Lambda Expression| ``pred``: 52 53.. parsed-literal:: 54 55 typedef min_element<s,pred>::type i; 56 57:Return type: 58 |Forward Iterator|. 59 60:Semantics: 61 ``i`` is the first iterator in |begin/end<s>| such that for every iterator ``j`` 62 in |begin/end<s>|, 63 64 .. parsed-literal:: 65 66 apply< pred, deref<j>::type, deref<i>::type >::type::value == false 67 68 69 70Complexity 71---------- 72 73Linear. Zero comparisons if ``s`` is empty, otherwise exactly ``size<s>::value - 1`` 74comparisons. 75 76 77Example 78------- 79 80.. parsed-literal:: 81 82 typedef vector<bool,char[50],long,double> types; 83 typedef min_element< 84 transform_view< types,sizeof_<_1> > 85 >::type iter; 86 87 BOOST_MPL_ASSERT(( is_same< deref<iter::base>::type, bool> )); 88 89 90See also 91-------- 92 93|Querying Algorithms|, |max_element|, |find_if|, |upper_bound|, |find| 94 95 96.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 97 Distributed under the Boost Software License, Version 1.0. (See accompanying 98 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 99