Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-05-26 04:11:00


Thomas Witt Sent:

> Neal Becker wrote:
>>
>> With STL we can do:
>> int x;
>> std::copy (&x, &x+1, output);
>
> Really? Did you mean to say int x[1]; ?
>

Surely not. That would be:
 int x[1];
 std::copy( x, x+1, output );

What Neal wrote is perfectly legal. See 5.7 para 4 in the standard:
"For the purposes of these operators [+ and -], a pointer to a nonarray
object behaves the same as a pointer to the first element of an array of
length one with the type of the object as its element type."

-- 
Martin Bonner
Martin.Bonner_at_[hidden]
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 203894

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