On 16-09-2015 14:13, Sam Kellett wrote:
[snip]
how come? i get that it's exposing the implementation, but the gains would
be so so massive. and the name flat_ basically confirms the use of a sorted vector internally.
Moving in a std::vector would force the flat_set to be implemented in terms of a std::vector. However, what about a type from flat_set, e.g. flat_set<T>::storage and document what concept this storage implements (e.g. Random Access Container), and then we could do what you want in a maybe cleaner way.
flat_set<T>::storage data; // fill data flat_set<T> the_set{std::move(data)};
Well, almost. IMO, we need three things to make it perfect: A. flat_set/map should have an additional template argument specifying the internal vector type (it can default to the current choice). B. You should be able to move the whole container, as suggested. C. The constructor should contain an assertion with a call to is_sorted() kind regards -Thorsten