
Hi, Boost.MultiIndex and Boost.Bimap implements a function named range. It is designed to integrate well with the new Boost.Range framework. The actual signature is: template< class LowerBound, class UpperBound > std::pair<iterator,iterator> range(LowerBound lower, UpperBound upper); template< class LowerBound, class UpperBound > std::pair<const_iterator, const_iterator> range(LowerBound lower, UpperBound upper) const; In bimap docs it is stated that the way to use it is: typedef bimap<string,int> bm_type; bm_type bm; //... std::pair<bm_type::left_iterator, bm_type::left_iterator>r = bm.left.range(...,...); I want to know if this is the best approach. Boost.Range defines two range classes (iterator_range and sub_range) http://www.boost.org/libs/range/doc/utility_class.html It is said that they are better abstraction for ranges that std::pair<iter,iter> 1) Do you think that the range functions should return a sub_range<map_type> instead of a std::pair<iter,iter>? The signature will be: template< class LowerBound, class UpperBound > sub_range<map_type> range(LowerBound lower, UpperBound upper); template< class LowerBound, class UpperBound > const sub_range<map_type> range(LowerBound lower, UpperBound upper) const; 2) In any case do you think that including typedef for the returned range type will make code more readable? The idea is to define: typedef -range_type- sub_range; // the name can be different typedef -const_range_type- const_sub_range; So the user code will look like this: typedef bimap<string,int> bm_type; bm_type bm; //... bm_type::left_sub_range r = bm.left.range(...,...); Best regards Matias