Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-02-11 03:47:12


David B. Held wrote:
> "Daniel Wallin" <dalwan01_at_[hidden]> wrote in message
>>No it should work as expected. This specialization forbids construction
>>from lvalues, conversions too.
>>
>> template<class U, BOOST_CONVERSION_PARAMETERS>
>> struct cant_move_from_const<
>> const smart_ptr<U, BOOST_CONVERSION_POLICIES>
>> >;
>
>
> I don't see how. This only gets "activated" during a call to:
>
> template <typename P>
> smart_ptr(P&, cant_move...<>);
>
> But, in this case:
>
> smart_ptr<Base, destructive_copy> p(
> smart_ptr<Derived, destructive_copy>(new Derived)
> );
>
> The better match is not smart_ptr(P&) but rather
> smart_ptr(smart_ptr<U>&), because the latter is more specialized.
> This seems to totally circumvent your system. Does the conversion
> c'tor also need to use the cant_move device? I.e.:
>
> template <typename U, policies...>
> smart_ptr(smart_ptr<U, policies>&p, cant_move..);

No, it doesn't need to be the best match. The error is generated when
the overload is considered during overload resolution. Whenever U is
substituted by smart_ptr<U, ...> const the compilation fails.

> <snip> If you are interested in trying to diagnose the problem
> yourself, I will try to update the sandbox with my working version.

Yes I can take a look at it. I only have access to gcc3.3.1 and and
2.95.3 though.

-- 
Daniel Wallin

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