|
Boost : |
From: Maxim Yegorushkin (e-maxim_at_[hidden])
Date: 2004-12-19 09:07:32
Peter Dimov wrote:
> Maxim Yegorushkin wrote:
>>
>> Does it really make any sense making only implementation noncopyable,
>> rather than interface?
>
> This would prevent you from making a copyable implementation of the
> interface.
No. Deriving from boost::noncopyable only suppress compiler generated copy
ctor and assignment. You still can define them and make your
boost::noncopyable successor copyable.
I think I just did not get you right.
>> If you deal with interfaces only it won't save
>> you from errors like this:
>>
>> std::auto_ptr<Interface> create() { return
>> std::auto_ptr<Interface>(new Implementation); }
>>
>> void foo()
>> {
>> std::auto_ptr<Interface> a(create()), b(create());
>
> Assuming you mean boost::shared_ptr here. auto_ptr doesn't work.
No, I meant std::auto_ptr<>. I overlooked the protected destructor :).
-- Maxim Yegorushkin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk