test-functor.cc File Reference

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <sigc++/sigc++.h>

Go to the source code of this file.

Functions

void print (int i)
bool even (int i)
int main (int argc, char *argv[])

Function Documentation

bool even ( int  i  ) 

Definition at line 15 of file test-functor.cc.

Referenced by main().

00016 {
00017     return i%2 == 0;
00018 }

int main ( int  argc,
char *  argv[] 
)

Definition at line 20 of file test-functor.cc.

References even(), and print().

00021 {
00022     vector<int> v1(10);
00023     iota(v1.begin(),v1.end(),1);
00024     vector<int> v2;
00025     remove_copy_if(v1.begin(),v1.end(),back_inserter(v2),slot(even));
00026     cout << "v1:\n";
00027     for_each(v1.begin(),v1.end(),print);
00028     cout << "v2:\n";
00029     for_each(v2.begin(),v2.end(),print);
00030     return 0;
00031 } // end of main()

void print ( int  i  ) 

Generated on 8 Jul 2019 for loon by  doxygen 1.6.1