August 2017
Intermediate to advanced
438 pages
14h 19m
English
Nothing needs to be done as boost::function<> is also usable with lambda functions of any difficulty:
#include <deque>//#include "your_project/process_integers.h"void sample() { // lambda function with no parameters that does nothing process_integers([](int /*i*/){}); // lambda function that stores a reference std::deque<int> ints; process_integers([&ints](int i){ ints.push_back(i); }); // lambda function that modifies its content std::size_t match_count = 0; process_integers([ints, &match_count](int i) mutable { if (ints.front() == i) { ++ match_count; } ints.pop_front(); });}
Read now
Unlock full access