GitHub - wygos/functors
functors
========
This library contains a set of small but useful functors and functors adapters. See functors_example.cpp for examples.
Minimal gcc : 4.7.2
minimal clang : 3.2
Caution! Extensive usage of c++11 features!
List of utilities:
SkipFunctor
takes any number of arguments; does completely nothing
ReturnSomethingFunctor<T,t>
takes any number of arguments; returns t;
IdentityFunctor
takes one parameter and returns it.
ReturnFalseFunctor
takes any number of arguments; returns false;
ReturnTrueFunctor
takes any number of arguments; returns true;
ReturnZeroFunctor
takes any number of arguments; returns 0;
AssertFunctor
takes any number of arguments; asserts;
ArrayToFunctor<Array>
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
A set of non-template logical operators functors (only operator() is templated):
* Not
* Or
* And
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>