123456789101112131415161718192021222324252627282930313233343536 |
- //#define CXXOMFORT_NOTICES 1
- #include <cxxomfort/functional.hpp>
- #include <cxxomfort/cstdint.hpp>
- #include <cxxomfort/algorithm.hpp> // copy_if
- #include <cxxomfort/array.hpp>
- #include <algorithm>
- #include <iterator>
- #include <iostream>
- #include <array>
- //#include <vector>
- bool mo3 (unsigned int u) { return u % 3 == 0; }
- int main () {
- using namespace std;
- cxxomfort::output_info(cout); cout<< endl;
- array<unsigned int, 10> A = {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}};
- copy_if (begin(A), end(A), ostream_iterator<unsigned int>(cout, " "), mo3);
- cout<< endl;
- copy_if (begin(A), end(A), ostream_iterator<unsigned int>(cout, " ")
- , not1( ptr_fun(mo3)) );
- cout<< endl;
- #if 1
- copy_if (begin(A), end(A), ostream_iterator<unsigned int>(cout, " ")
- , not_fn( ref(mo3)) );
- cout<< endl;
- #endif
- cout<< "algorithms: "<< CXXO_COMPILER_SUPPORT_std_cxx11_algorithms<< endl;
- cout<< "sorted: "<< is_sorted(begin(A), end(A))<< endl;
-
- cout<< mo3(3)<< endl;
- cout<< !mo3(3)<< endl;
- cout<< not_fn(mo3)(3)<< endl;
-
- }
|