3 Mar
2010
3 Mar
'10
3:54 p.m.
Gabriel Redner wrote:
If I have a pair of iterators, I can construct a set like so:
std::set<SomeType> s(it1, it2);
If instead I have a range, I can adapt it like so:
std::set<SomeType> s(boost::begin(range), boost::end(range));
However, my range object is being constructed on the fly. I'd like to be able to do:
std::set<SomeType> s(MakeRange(args));
what about template<typename Container> void assign_range(Container& c, const Range& r) { c.assign(begin(r), end(r)); } std::set<SomeType> s; assign_range(s, MakeRange(args));