Poster of Linux kernelThe best gift for a Linux geek
Negators

Negators

Section: C Library Functions (3) Updated: 27 Aug 2009
Local index Up
 

NAME

Negators -  

Classes


class binary_negate< _Predicate >
One of the negation functors.
class unary_negate< _Predicate >
One of the negation functors.  

Functions


template<class _Predicate > unary_negate< _Predicate > not1 (const _Predicate &__pred)

template<class _Predicate > binary_negate< _Predicate > not2 (const _Predicate &__pred)
 

Detailed Description

The functions not1 and not2 each take a predicate functor and return an instance of unary_negate or binary_negate, respectively. These classes are functors whose operator() performs the stored predicate function and then returns the negation of the result.

For example, given a vector of integers and a trivial predicate,

  struct IntGreaterThanThree
    : public std::unary_function<int, bool>
  {
      bool operator() (int x) { return x > 3; }
  };

  std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree()));


 The call to find_if will locate the first index (i) of v for which '!(v[i] > 3)' is true.

The not1/unary_negate combination works on predicates taking a single argument. The not2/binary_negate combination works on predicates which take two arguments.  

Function Documentation

 

unary_negate<_Predicate> std::not1 (const _Predicate & __pred) [inline]

One of the negation functors.

Definition at line 329 of file stl_function.h.  

binary_negate<_Predicate> std::not2 (const _Predicate & __pred) [inline]

One of the negation functors.

Definition at line 355 of file stl_function.h.  

Author

Generated automatically by Doxygen for libstdc++ from the source code.


 

Index

NAME
Classes
Functions
Detailed Description
Function Documentation
unary_negate<_Predicate> std::not1 (const _Predicate & __pred) [inline]
binary_negate<_Predicate> std::not2 (const _Predicate & __pred) [inline]
Author

This document was created by man2html, using the manual pages.
Time: 22:38:27 GMT, April 16, 2011