Boost logo

Boost :

From: Raoul Gough (RaoulGough_at_[hidden])
Date: 2004-02-16 14:56:19


"Peter Dimov" <pdimov_at_[hidden]> writes:

> David Abrahams wrote:
>> "Peter Dimov" <pdimov_at_[hidden]> writes:
[snip]
>>> The compiler can place a temporary of type "int const" and value 5
>>> in ROM, and pass its address to f. Similarly, in:
>>>
>>> struct X
>>> {
>>> int i;
>>> X(int i): i(i) {}
>>> };
>>>
>>> void f(X const & x);
>>>
>>> int main()
>>> {
>>> f( X(5) );
>>> }
>>>
>>> the compiler is allowed to construct a "X const" with a value of
>>> X(5) at compile time and place it in ROM.
>>
>> OK. Relevance?
>
> I seem to recall attempts to strike down that second bullet of the first
> bullet of the second bullet of 8.3.5/5 :-) and demand that the reference be
> bound to the object represented by the rvalue. At the time, this seemed a
> reasonable idea, but then I came up with the ROM example. Maybe it's already
> widely known and I'm just reinventing the wheel.

BTW, what does the standard actually say about the const-ness of
introduced temporaries? I'd always assumed that they would be
non-const in the same way as rvalues of class type, but I've obviously
missed something.

-- 
Raoul Gough.
export LESS='-X'

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