Michael Fawcett ha escrito:
Joaquín, thanks so much for a wonderful library. I was wondering why there is no constructor that simply takes an allocator. This would make multi_index behave more like STD Library containers, which would aid me in allowing flexible storage options for generic algorithms.
Is there a technical hurdle that makes this difficult to do? You currently provide:
explicit multi_index_container( const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type());
template<typename InputIterator> multi_index_container( InputIterator first,InputIterator last, const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type());
Is it possible to also provide:
explicit multi_index_container( const allocator_type& al=allocator_type());
?
Hello Michael, Not all STL containers provide an allocator ctor (associative containers don't), which is the implicit reason why I didn't include it (I followed std::set's interface in the initial designs). That said, I don't see any technical problem in providing that ctor, so I'm putting it in my todo list for the next release (Boost 1.36, I'm afraid). Thanks for using Boost.MultiIndex, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo