Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-02-11 11:44:57


"Rani Sharoni" <rani_sharoni_at_[hidden]> writes:

> David Abrahams wrote:
>> "Rani Sharoni" <rani_sharoni_at_[hidden]> writes:
>>
>>>>> When source and destinations un-cv types are the same or
>>>>> base/derived direct initialization and copy initialization are the
>>>>> same (per 8.5/14/4/2) and this fact was (viciously) exploited by
>>>>> the old auto_ptr.
>>>>
>>>> Something's missing from that sentence to make it comprehensible.
>>>>
>>>> It has the same grammatical structure as "When my hand is blue or my
>>>> hair is green and I was a fool", which is not a complete sentence.
>>>
>>> I'm not sure that I understand your intention.
>>
>> I'm trying to say that I don't understand what you're saying in that
>> "sentence", and I'm trying to explain why I don't understand it. The
>> "sentence" is grammatically incomplete. I'd like you to explain what
>> you're trying to say.
>
> For some reason I thought that what I wrote is so trivial that even
> grammar errors will not hide my intentions. It seems that Christoph
> Ludwig understand my intentions.

I tend to be overly literal minded, and the missing comma after
"derived" threw me off.

> Direct initialization is the *same* as copy initialization when
> constructing object of the same type using non-explicit
> (i.e. converting) constructor.
>
> struct A { A(int); };
>
> A a1(A(10)); // #1
> A a2 = A(20); // #2 same as #1
>
> Both initializations are the same per 8.5/14/4/2:
> <Q> If the initialization is direct-initialization, or if it is
> copy-initialization where the cv-unqualified version of the source type is
> the same class as, or a derived class of, the class of the destination,
> constructors are considered. The applicable constructors are enumerated
> (13.3.1.3), and the best one is chosen through overload resolution (13.3).
> </Q>

So you're basically saying that in my suggested text:

   "A temporary of type ``cv1 T2'' [sic] is constructed using direct
   initialization from the rvalue object. The reference is bound to
   the temporary or to a sub-object within the temporary"

the mention of direct initialization is pointless and could be
written :

   "A temporary of type ``cv1 T2'' [sic] is initialized from the
   rvalue object. The reference is bound to the temporary or to a
   sub-object within the temporary"

??

I think the text has to account for the possibility that the
constructor used might be explicit, doesn't it?

> IMO your suggestion is fully compliant and EDG has bug that confuses
> everyone.
>
> I don't have anything else to add to this discussion.

Sorry to draw it out, but I don't understand when you say "suggestion"
whether you're referring to my suggested text change or the movable
class idiom I posted.

> Thanks,
> Rani
>
> No alarms and not surprises silence.

Wow, parse error again. Radiohead?

-- 
Dave Abrahams
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