|
Boost : |
Subject: Re: [boost] [MultiIndex] STL algorithm support for multi_index_containers
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2008-11-09 11:23:06
Arno Schödl <aschoedl <at> think-cell.com> writes:
>
> Hello,
>
> we have added support for using multi_index ordered index iterators in
> lieu of random access iterators in standard algorithms that require
> sorted ranges, e.g. lower_bound, upper_bound, equal_range, and
> binary_search. This is useful when using these iterators in generic
> algorithms that internally call lower_bound/upper_bound/etc. Our
> implementation is attached. We are currently overloading
> std::lower_bound/... which is illegal. I propose introducing a
> boost::lower_bound/..., where we can ignore the C++ standard restriction,
> and where the standard implementation forwards to std::lower_bound.
I think this can be a useful addition, and maybe other Boost
containers (ptr_container, intrusive) can provide their own overloads
too. boost::lower_bound is no different in this respect to other
initiatives like boost::swap.
BTW, why does the standard forbid overloading std functions for
user-defined types? I'm sure thre's a a good reason for that, but
never found a explicitly stated rationale.
JoaquÃn M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk