Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-04-22 16:04:49


Anatoli Tubman wrote:
> Alexander Nasonov wrote:
>
>> Slicing problem should be solved because it's easy to forget & between
>> crange<int> and r. I wish we were able to typedef a reference to
>> 'crange_impl<int, d_array> const' as crange<int>.
>
>
> Just make the assignment operator private to get a friendly compiler
> error message :)

This is in reference to the following line of code:
   for (crange<int> const & r = mkrange(d); r; ++r)

Making the assignment operator private would do nothing since it is not
being called here. Making the copy constructor private wouldn't help
either because the copy constructor must be accessible in order to bind
a temporary to a const reference. (Not all compilers enforce this rule.)

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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