Boost logo

Boost :

Subject: [boost] [functors] proposal
From: Piotr Wygocki (vwygos_at_[hidden])
Date: 2013-10-22 16:16:12

Hi, I've developed a small set of functors and functor adaptors.
Although this code is very simple it might be very useful for some subset
of the community.

Do you think it might become a part of the boost library?
If not I'm still very interested in any feedback.
I think it's not big enough to be a separate library.
To my knowledge of boost it fits in the utility lib.

The code can be found here:

List of utilities:

    takes any number of arguments; does completely nothing

    takes any number of arguments; returns t;

    takes one parameter and returns it.

    takes any number of arguments; returns false;

    takes any number of arguments; returns true;

    takes any number of arguments; returns 0;

    takes any number of arguments; asserts;

    Stores an object which provides operator[].
    Provides operator()().

A set of non-template comparison functors (only operator() is templated):
  * Greater
  * Less
  * GreaterEqual
  * LessEqual
  * EqualTo
  * NotEqualTo

FunctorToComparator<Functor, Compare>
    This comparator takes a functor "f" and a comparator "c".
    For elements (x,y) it returns c(f(x), f(y))
    c is Less by default

    The output iterator stores a functor and
    each time the operator= is called the given functor is called

Logical operators as functors:
    * Not
    * Or
    * And
    * Xor

LiftBinaryOperatorFunctor<Operator, FunctorLeft, FunctorRight>
    Functor stores a binary operator "o" and two functors "f" and "g".
    For given arguments args returns o(f(args), g(args)).

Boolean functor adapters. Each of them stores a boolean functor
and performs an appropriate logical operation in the operator().

    * NotFunctor<Functor>
    * OrFunctor<FunctorLeft, FunctorRight>
    * AndFunctor<FunctorLeft, FunctorRight>
    * XorFunctor<FunctorLeft, FunctorRight>



Boost list run by bdawes at, gregod at, cpdaniel at, john at