$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Aaron W. LaFramboise (aaronrabiddog51_at_[hidden])
Date: 2007-06-03 11:11:33
Does Boost have some sort of uninitialized storage container?
Presently, I use this pattern if I want to delay construction of a
sub-object.
class my_class {
public:
my_class() {
// ...
subobject = auto_ptr<type>(new type(params));
}
private:
auto_ptr<type> subobject;
};
But I'd like something similar that didn't use the heap, but instead
allocated the storage for the sub-object within the class object itself.
Perhaps it would look like this.
class my_class2 {
public:
my_class2() {
// ...
subobject.construct(params);
}
private:
uninitialized_container<type> subobject;
};
A TR1 array<T, sizeof(T)> almost works, except for these points:
(1) It doesn't provide proper alignment guarantees.
(2) It doesn't call the destructor when it is destroyed.
So, does Boost have any such thing?