G<F> _NOT_( F f );
where :
Parameter | Description |
---|---|
f | a functor returning a boolean value |
A functor of type G<F>
Creates a functor that returns the negation of f
result.
#include <iostream> #include <vector> #include "sftl.h" using namespace std; bool dividable_by_2( int x ) { return (x%2)==0; } int main() { // create vector of numbers int numbers [] = {1,2,3,4,5,6,7,8,9}; vector<int> v_numbers( &numbers[0], &numbers[9] ); // extract the numbers non dividable by 2 vector<int> v = filter( v_numbers, _NOT_(dividable_by_2) ); // v contains 1 3 5 7 9 }