Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-08-09 07:58:00

> >> Say what?
> >>
> >> You can define only one instance of a static member per class.
> >
> >This is exactly want I want: a unique id for each ptr<T> generated.
> >and ptr<Y> are not the same class.
> Then why did you claim that "the information will be specific
> to each .cpp source file since static members are declared in
> the header" and that the "size of s_rectify ... is directly
> proportional to the number of static_cast<> combinations the
> .cpp file will need" ?

Each different combinaisons of ptr<T> = new () U() are wrote down.

> As far as I can tell your program will violate the one
> definition rule. And if you fix that the size of ptr s_rectify
> will be proportional to the largest id needed in any source. I
> suspect you are trying to take advantage of the ODR not being
> enforced on your program. Or maybe it's just because your
> test program is only one file that it seems to work

If the static members are defined onces it will still be ok, the s_rectify
will only be larger. One .cpp, two .cpp or a hundred .cpp doesn't matter;
it'll still work.

All of those lookup tables form one matrix, but highly simplified and still
can be but I wanted to demonstrate an acceptable example and prove its
benefits before going any further. At some point I would like some help for
portability issues because it's the most priorized one in your group, and
other stuff.

> I mentioned it as a source of ideas, not as code that you could
> use as is. I am convinced that you can make a smart pointer
> with the properties you describe, but not the way you are trying
> to do it.


Philippe A. Bouchard

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