Boost logo

Boost :

Subject: Re: [boost] [review] Review of PolyCollection starts today (May 3rd)
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2017-05-06 09:07:03

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;
   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 . Didn't you find this
sufficiently explanatory?

Joaquín M López Muñoz

Boost list run by bdawes at, gregod at, cpdaniel at, john at