Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-30 11:57:00


From: "Gennadiy Rozental" <rogeeff_at_[hidden]>
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:00e001c1f062$2c032770$1d00a8c0_at_pdimov2...
> > From: "Gennadiy Rozental" <rogeeff_at_[hidden]>
> > > "Andrei Alexandrescu" <andrewalex_at_[hidden]> wrote in message
> > > news:aalc6e$5fo$1_at_main.gmane.org...
> > > >
> > > > I don't understand the situation you describe.
> > > >
> > > >
> > > > Andrei
> > > >
> > >
> > > The point I am trying to make here is that in many (most?) cases
using
> > > traits is not a problem (if traits are applicable), cause the
situation
> > you
> > > describing is a little bit artificial. Could you provide a real-life
> > example
> > > where it became the issue?
> >
> > // a.cpp
> >
> > class X;
> > smart_ptr<X> px;
> >
> > // b.cpp
> >
> > #include "X.hpp"
> > smart_ptr<X> px2;
> >
> Could your add couple words here: What is the problem? How a.cpp and b.cpp
> are connected? how a.cpp is going to use X?

X is defined in X.hpp, along with the associated traits specializations. The
problem, with a smart_ptr that uses the type of its template parameter to
somehow alter its type (via traits, sizeof(expression-involving-X), or some
other mechanism), is that a.cpp sees a different smart_ptr<X>. So there's an
ODR violation.

Note that shared_ptr doesn't have this problem.


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