Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-02-11 11:58:20

On Fri, Feb 11, 2005 at 11:11:51AM -0500, John Eddy wrote:

> Thank you Jonathan and Tony,
> Fortunately, the class in which I am using this construct is templatized
> so the initializations as you (Tony) suggested are fine appearing just
> below the class. If it weren't a templatized class, doing so would
> produce multiply defined symbol errors. I suppose the only way around
> that is to have an implementation file which requires a library be
> built, etc. yes? (bummer)

That's right. If you couldn't have an implementation file where the
member could be defined then you would have to either ensure that you
never "use" the member in your program (where "use" doesn't include using
it as an integral constant expression, but does include many other
useful things, such as taking a reference to it or its address,) or you
could replace it with an enumerator:

    class S {
      enum { l1 = 23 };

An enumerator has no storage, so *can't* be "used" in the program in a
way that would cause problems.



"There are perhaps 5% of the population that simply *can't* think.
 There are another 5% who *can*, and *do*.
 The remaining 90% *can* think, but *don't*."
	- R. A. Heinlein

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