Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

Negators


Function Object

Summary

Function adaptors and function objects used to reverse the sense of predicate function objects.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

None

Synopsis

#include <functional>
template <class Predicate>
class unary_negate;

template <class Predicate>
unary_negate<Predicate> not1(const Predicate&);

template <class Predicate>
class binary_negate;

template <class Predicate>
binary_negate<Predicate> not2(const Predicate&);

Description

Negators not1 and not2 are functions that take predicate function objects as arguments and return predicate function objects with the opposite sense. Negators work only with function objects defined as subclasses of the classes unary_function and binary_function. not1 accepts and returns unary predicate function objects. not2 accepts and returns binary predicate function objects.

unary_negate and binary_negate are function object classes that include return types for the negators, not1 and not2.

Interface

template <class Predicate>
class unary_negate
  : public unary_function
           <typename Predicate::argument_type, bool> {

public:
  explicit unary_negate (const Predicate&);
  bool operator() (const argument_type&) const;
};

template<class Predicate>
unary_negate <Predicate> not1 (const Predicate&);

template<class Predicate>
class binary_negate
  : public binary_function
           <typename Predicate::first_argument_type,
            typename Predicate::second_argument_type, bool>
{
public:
  explicit binary_negate (const Predicate&);
  bool operator() (const first_argument_type&,
                   const second_argument_type&) const;
};

template <class Predicate>
binary_negate<Predicate> not2 (const Predicate&);

Example

Program Output

See Also

Algorithms, binary_function, Function Objects, unary_function



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998