Boost logo

Boost :

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


"Anatoli Tubman" <anatoli_at_[hidden]> wrote in message
news:4087D552.8000209_at_ptc.com...
| 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?
[snip]
| 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++() ?

br

Thorsten


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