Re: question regarding std::9.4.2/4 (static data members of const integral type)
{ Please include some quoting to establish context. Here, the link was
<http://groups.google.co.uk/group/comp.lang.c++.moderated/browse_thread/thread/acc3ab22cc82325e/fb5ce1b0f1d39f9e>.
-mod }
Thanks for the link. My mistake was that I had been still using the
first version of the standard (1998). As pointed out in the referred
discussion, the relevant definition of "used" is given in section 3.2.
Quoted from the second version (2003):
3.2 One definition rule [basic.def.odr]
2 An expression is potentially evaluated unless it ***appears where
an integral constant expression is required (see 5.19),*** is the
operand of the sizeof operator (5.3.3), or is the operand of the
typeid operator and the expression does not designate an lvalue of
polymorphic class type (5.2.8). An object or non-overloaded function
is used if its name appears in a potentially-evaluated expression. ...
The main difference to the first version is the relaxation of the
term "potentially evaluated" (marked with *** above). To confirm
my interpretation: Given the example of boost::is_base_of,
struct PropA
{
static const bool value = ...;
};
struct PropB
{
static const bool value = ...;
};
template< typename Base, typename Derived >
struct is_base_of
: ::boost::integral_constant< bool,
::boost::type_traits::ice_or< PropA::value, PropB::value >::value
>
{};
the static const member ice_or<...>::value is used in terms of the
1998 standard but not in terms of the 2003 standard?
So the namespace-scope definition of this member/these members had
been necessary regarding the 1998 version?
Browsing the latest draft of the C++0x standard, I realized that
the things seem to change very much. Is it correct that we will be
allowed to write
template< typename Base, typename Derived >
struct is_base_of
: ::boost::integral_constant< bool, PropA::value || PropB::value >
{};
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]