Boost logo

Boost Users :

Subject: [Boost-users] [Range] Help with syntax
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2018-10-18 14:02:07


Given

struct S { int i( ) const; };
vector<S> v;
set<int> s;

I want to write (approximately)

for_each( v | transform( []( const S & s ){ return s.i( ); } ), s.emplace );

With the intention putting all the i's extracted from v into the set s. My
syntax
is all over the place, and I'm not sure how to express the s.emplace bit.

Also is there a better way to say the whole thing? If I were doing
push_back instead
of emplace there's a facility especially for that, but I guess Boost::Range
 hasn't
embraced emplace because range-v3 is around now.

I'm sure some of you are fluent in this stuff!

Kind Regards

Rob.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net