
26 Nov
2009
26 Nov
'09
10:38 a.m.
2009/11/26 Peder Holt <peder.holt@gmail.com>:
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