Re: [boost] Problem with range?

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@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 203894

Martin Bonner wrote:
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."
I knew I must have missed something. Thanks for the pointer. crawling-under-a-rock-ly yours Thomas -- Thomas Witt witt@acm.org
participants (2)
-
Martin Bonner
-
Thomas Witt