Boost logo

Boost :

Subject: Re: [boost] [unordered] unordered_set::erase() complexity bug?
From: Daniel James (daniel_james_at_[hidden])
Date: 2009-11-26 05:38:00


2009/11/26 Peder Holt <peder.holt_at_[hidden]>:
>> Would it be possible to implement lazy evaluation of the iterator?
>
> template<typename UnorderedSet>
> class lazy_iterator_evaluator {
> public:
>    lazy_iterator_evaluator(...)
>    typedef typename UnorderedSet::iterator iterator;
>    operator iterator() {//Do the heavy calculations here}
> };
>
> an let erase return this instead?
> lazy_iterator_evaluator<unordered_set<T> > unordered_set<T>::erase(...);

I don't think that's really permissible by the standard. And if you
consider that C++'s limited type inference (ie. templates and 'auto'
would propagate this type) and its complicated overload rules, it's
hard to implement this in a way that wouldn't break something
somewhere.

Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk