Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-22 10:56:45

"Anatoli Tubman" <anatoli_at_[hidden]> wrote in message
| John Torjo wrote:
| >
| > However, had I used
| > crange<int> r(d); // how do I know what iterators to keep inside?
| > crange<int> r(v); // how do I know what iterators to keep inside?
| Another option is to write
| for (crange<int>& r = mkrange(d); r; ++r) { ... }
| where mkrange returns crange_impl<int, d_array> which is derived from
| crange<int>.
| This doesn't need heap allocation, but still needs virtual operator++
| and virtual operator*. A smart compiler could in theory inline them
| anyway, but I wouldn't count on it.

virtual dispatching would be most unfortunate here. What about
letting crange's constructor take a pointer to crange_impl and forward to
crange_impl::operator++() inside crange_impl::operator++() ?



Boost list run by bdawes at, gregod at, cpdaniel at, john at