less


A binary function object that returns true if its first operand is less than its second operand.

Library

Standards<ToolKit>

Declaration

#include <functional>

template< class T >
struct less : binary_function< T, T, bool >

Interface

()
bool operator()( const T& x , const T& y ) const
Returns x < y .
Example <ospace/osstd/examples/less.cpp>
#include <iostream>
#include <algorithm>
#include <functional>

int array[ 4 ] = { 3, 1, 4, 2 };

void
main()
  {
  sort( array, array + 4, less< int >() );
  for ( int i = 0; i < 4; ++i )
    cout << array[ i ] << "\n";
  }

1
2
3
4

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.