|
Boost Users : |
From: Alexandre Carsac (acarsac_at_[hidden])
Date: 2002-11-18 12:41:22
Hi, alls
Just wondering if there is some issue to the following problem (a and b instance are not in the same block code in true life of course) :
class A;
class B : public A ...
void main()
{
shared_ptr<A> a;
shared_ptr<B> b(new B);
a = b; // what i would like, but it wont compile: no copy ctor available
}
I can try to do something like:
void main()
{
shared_ptr<A> a;
shared_ptr<B> b(new B);
a.reset(b.get()); // bad design, reference counter corruped
}
I do not want to do something like the following, because each time i will need of b, i will be obliged to cast again to B type.
main()
{
shared_ptr<A> a;
shared_ptr<A> b(dynamic_cast(new B));
a = b;
}
Any solutions ?
---------------------------------
Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !
[Non-text portions of this message have been removed]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net