I have the following structure:
typedef boost::multi_index_container<
MyClass,
boost::multi_index::indexed_by<
boost::multi_index::hashed_unique
MyClassSet;
If i populate it in a loop: MyClassSet all: for (int y = 0; y < input.rows; ++y) { MyClass c; // .... all.insert(c); } the insertion time is quite slow. It probably need to continuously re-order the underlying implementation. Anyway i would expect that populating it with a single call it would be faster (e.g. sorting the whole set only at the end). Example: std::vector<MyClass> vec; // ... MyClassSet all(vec.begin(), vec.end()); BUT... the times are almost equal. My question is: is this intended behaviour? Is there a faster way to mass populate the container (e.g. not enforcing the invariants/orderings at each 'insert')?