Back to Arangodb

min_element

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/min-element.html

3.12.9.12.9 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Querying Algorithms / min_element |

min_element

Synopsis

template<
      typename Sequence
    , typename Pred =[less](./less.html)<[\_1](./placeholders.html),[\_2](./placeholders.html)>
    >
struct[min\_element](./min-element.html){
    typedef_unspecified_type;
};

Description

Returns an iterator to the smallest element in Sequence.

#include <[boost/mpl/min\_element.hpp](../../../../boost/mpl/min_element.hpp)>

Parameters

ParameterRequirementDescription
SequenceForward SequenceA sequence to be searched.
PredBinary Lambda ExpressionA comparison criteria.

Expression semantics

For any Forward Sequence s and binary Lambda Expression pred:

typedef[min\_element](./min-element.html)<s,pred>::type i;

| Return type: |

Forward Iterator.

| | Semantics: |

i is the first iterator in [begin<s>::type, end<s>::type) such that for every iterator j in [begin<s>::type, end<s>::type),

[apply](./apply.html)< pred,[deref](./deref.html)<j>::type,[deref](./deref.html)<i>::type >::type::value == false

|

Complexity

Linear. Zero comparisons if s is empty, otherwise exactly size<s>::value - 1 comparisons.

Example

typedef[vector](./vector.html)<bool,char[50],long,double> types;
typedef[min\_element](./min-element.html)<[transform\_view](./transform-view.html)< types,[sizeof\_](./sizeof.html)<[\_1](./placeholders.html)> >
    >::type iter;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[deref](./deref.html)<iter::base>::type, bool> ));

See also

Querying Algorithms, max_element, find_if, upper_bound, find

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |