May 2017
Intermediate to advanced
590 pages
17h 18m
English
You should prefer to use lambda expressions to pass callbacks to standard algorithms instead of functions or function objects:
auto numbers = std::vector<int>{ 0, 2, -3, 5, -1, 6, 8, -4, 9 }; auto positives = std::count_if( std::begin(numbers), std::end(numbers), [](int const n) {return n > 0; });
auto ispositive = [](int const n) {return n > 0; }; auto positives = std::count_if( std::begin(numbers), std::end(numbers), ispositive);
Read now
Unlock full access