Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

[Home]greater

Synopsis

template<
      typename T1
    , typename T2
    >
struct greater
{
    typedef unspecified type;
};

Description

Returns true_ if T1::value > T2::value and false_ otherwise [1].

Definition

#include "boost/mpl/greater.hpp"

Parameters

 Parameter  Requirement  Description  
T1, T2A model of Integral Constant

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef greater<t1,t2>::type c;A model of bool Integral ConstantEquivalent to typedef bool_<(t1::value > t2::value)> c;

Complexity

Amortized constant time.

Example

typedef list_c<int,1,2,3,5,7,12,19,31> fibonacci;
typedef find_if< fibonacci, greater<_1,int_<10> > >::type iter;
BOOST_STATIC_ASSERT(iter::type::value == 12));

Notes

[1] The greater metafunction can be (and is expected to be) specialized by user to work on user-defined types that do not satisfy the Integral Constant requirements. The requirements listed here are the ones imposed by the default implementation.

See also

Metafunctions, greater_equal, less, less_equal, equal_to, not_equal_to


Table of Contents
Last edited March 10, 2003 6:24 am