Boost logo

Boost :

From: Björn Karlsson (Bjorn.Karlsson_at_[hidden])
Date: 2002-09-26 06:38:58

> From: Markus Schöpflin [mailto:markus.schoepflin_at_[hidden]]
>attached are two small patches for MPL which fix some of the type_traits
>tests for vacpp 5.02. The tests that additionally pass with this patch
>are arithmetic_traits_test, cv_traits_test, is_convertible_test and
>BTW, are the mpl tests missing from the status/Jamfile on purpose?

I'm confused - I thought that BOOST_STATIC_CONSTANT already does The Right
Thing by declaring an enum if there's no support for in-class member
initialization? What am I missing?

Answer to self (with a little help from the Standard):

"If a static data member is of const integral or const enumeration type, its
declaration in the class
definition can specify a constant initializer which shall be an integral
constant expression (5.19). In that
case, the member can appear in integral constant expressions within its
scope. The member shall still be
defined in a namespace scope if it is used in the program and the namespace
scope definition shall not contain
an initializer."

The key: "The member shall still be defined in a namespace scope if it is
used in the program..."

But doesn't this imply that every use of BOOST_STATIC_CONSTANT must be
followed by a (out-of-class) definition #ifdef:ed with
BOOST_NO_INCLASS_MEMBER_INITIALIZATION? If that's the case, I guess we need
a twin macro - BOOST_STATIC_CONSTANT_DEFINITION (or just use enums). Would
someone enlighten me, please?

Bjorn Karlsson

Boost list run by bdawes at, gregod at, cpdaniel at, john at