El 06/05/2017 a las 5:53, Edward Diener via Boost escribió:
On 5/2/2017 7:46 PM, Ion Gaztañaga via Boost wrote:
Hi everyone,
The formal review of Joaquín M. López Muñoz's PolyCollection library starts today. [...]
* boost::function_collection
I could not understand from the documentation what it is I am supposed to be inserting into a function_collection. The tutorial did not explain this to me and the reference's technical explanation on this eluded me.
You can insert into a boost::function_collection<Signature> any entity that a std::function<Signature> object could be constructed from. For instance, boost::function_collection<double(int)> holds callable entities that can be invoked with a (convertible to) int argument and return a (convertible to) double result: double f(int n){return (double)n;} struct g { double operator()(int n)const{return (double)2*n;} }; boost::function_collection<double(int)> c; c.insert(&f); c.insert(g{}); double factor=3; c.insert([=](int n){return factor*n;}); for(const auto& x:c)std::cout<<x(1)<<" "; // prints 3 1 2 This is explained in http://tinyurl.com/kddv9nz . Didn't you find this section sufficiently explanatory? Joaquín M López Muñoz