Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-09-17 10:49:17


Anthony Williams wrote:
>
> Markus Schöpflin writes:
> > Jaap Suter wrote:
> > >
> > > I think http://www.boost.org/more/int_const_guidelines.htm will help you
> > > out...
> > >
> >
> > Either I'm too blind to see it or it is not there.
> >
> > But reading the bible (read: the c++ standard), section 5.19 tells
> > me that is should look in 9.4.2 (static data members). And sentence
> > 4 of 9.4.2 tells me that "The member shall [still] be defined in
> > namespace scope if it is used in the program ..."
> >
> > 14.5.1.3 (Static data members of class templates) says that
> > "A definition for a static data member may be provided in a
> > namespace scope enclosing the definition of the static member's
> > class template."
> >
> > So this looks like the code I posted should be legal?
>
> Yes this is legal. The restriction that "there shall be exactly one definition
> of a static data member that is used in a program; no diagnostic required",
> does not apply to static data members of templates, so long as the duplicate
> definitions are in every sense identical (see 3.2p5).
>
> Anthony

Aha, thanks. But does the word "may" in 14.5.1.3 refer to the definition
of the static data member or does it refer to where the definition is
allowed to live?

In other words, do I _have_ to provide a definition or is the definition
itself optional?

TIA, Markus


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