Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-10-05 05:37:15


----Original Message----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of Frank Birbacher
Sent: 05 October 2006 10:00 To: boost_at_[hidden]
Subject: Re: [boost] Geometry/Vector Lib

> Hi!
>
> Jason Hise schrieb:
>> vec[0] = 42;
>> vec[_x] = 42; // does the same thing
>
> "_x" is not allowed as a variable name.
Yes it is. 17.4.3.1.2 [lib.global.names] in the standard says:
- Each name that contains a double underscore (_ _) or begins with an
underscore followed by an uppercase letter (2.11) is reserved to the
implementation for any use.
- Each name that begins with an underscore is reserved to the
implementation for use as a name in the global namespace.

_x is legal if it is defined in (eg) boost::geometry and brought in via
a using statement.
The real problem is that leading _ is a fairly common convention for
"member variable", and as you mention below, a member named 'x' in a
mathematical context is not inconceivable!

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