
18 Jul
2012
18 Jul
'12
2:49 p.m.
On Wednesday 18 July 2012 07:40:17 Amir Ansari wrote:
Thanks. This is exactly what I was looking for. Some questions:
1. Is there any container that allows inserting without providing a value of the contained type, but rather, some other type? Essentially, it would rely on a non-default constructor that takes the other type as input.
Yes, many Boost containers support emplace*() methods. In C++11, STL containers also support it.
2. Is there some specialization for flat_set with the same semantics as ptr_vector ?
I'm not sure I understand. Do you intend to store pointers in flat_set? If so, you can store std::unique_ptr's or shared_ptr's and specify your custom ordering predicate to order pointers by their pointees.