|
Boost Users : |
From: voodoo4 (voodoo4_at_[hidden])
Date: 2004-02-25 14:27:37
I downloaded yesterday the boost libraries (mainly for the memory libs) and
to tell the truth i'm impressed with pool and smart pointers.
Especially the boost smart pointers will save me from months of coding!
However i have a question about smart pointers.
Let's say i have these objects(the code is just an example):
class Slave
{
Slave();
~Slave();
};
class Master
{
Master();
Master(int size);
~Master();
Slave *sl;
};
I want "sl" to be an array of Slaves on the free store but the sized will be
determined in the constructor.
With normal pointers i would write:
Master::Master(int val)
{
sl=new Slave[val];
}
Master::~Master()
{
delete sl;
}
How can i achieve the same with boost smart pointers?
I've read the manual three or four times but i still don't get how to work
this out.
Does this have something to do with the empty ptr?
I believe solution is in front of my eyes but i'm too blind(as usual) to see
it...
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