
On Jun 14, 2006, at 4:56 AM, John Maddock wrote:
Gottlob Frege wrote:
if unknown_struct is an incomplete type (which is what I meant, and should have said), alignment_of doesn't compile.
If the type is incomplete then you can't use aligned_storage anyway, since you don't know how much storage you'll need! Sorry but you've lost me now.
There are applications such as boost::function where aligned storage
for an unknown type is useful. In boost::function's case, aligned
storage could be used to implement the "short string optimization".
The general pattern is:
class Container
{
private:
const unsigned buf_size = ...;
aligned_storage
I think what the OP is looking for is called boost::shared_ptr ;-)
shared_ptr can't compete with this application performance-wise. -Howard