Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-04-30 00:35:10


"Andrei Alexandrescu" <andrewalex_at_[hidden]> wrote in message
news:aal0ii$nbo$1_at_main.gmane.org...
> "Gennadiy Rozental" <rogeeff_at_[hidden]> wrote in message
> news:aal00v$mjr$1_at_main.gmane.org...
> > It won't it users will use distinct type like SharedWidgetPtr. Users
could
> > use Widget* directly but it is the case with the policy-based solution
> > either. "Might even link and run in certain cases!"
>
> This argument doesn't hold water. If users use Widget* directly, they have
> and expect a regular pointer, not a smart pointer. On the contrary, in the
> case of an ODR violation, users faithfully do everything they think it's
> reasonable doing, yet the code goes amok.
>

I still disagree that you describe a widely spread real-life situation. Let
see what are the condition when what you describing may occur:

1. You are using some third party library (Widget). In other case you would
just put you specialization into Widget header.
2. You code is used as third party library by somebody else. In other case
(you write code for yourself) you would know what kind of smart_ptr to use
for Widget. At least you would remember to use SharedWidgetPtr you wrote for
yourself.
3. Users of your library for some reasons ignore your interface (that
contain SharedWidgetPtr. in other case if SharedWidgetPtr is implementation
detail user of your library should not bother at all) and define their own
smart pointer on widget. That again could either fail to compile, work if
SharedWidgetPtr smart enough to properly convert into some other smart_ptr.
I should work also because SharedWidgetPtr is in you interface and your
specialization will also be there.

I assume that I probably missing some cases. But still they does seems to be
rare.

>
> Andrei
>

Regards,

Gennadiy.


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