|
Boost Users : |
From: Matthias Hofmann (hofmann_at_[hidden])
Date: 2006-09-18 08:39:58
"David Abrahams" <dave_at_[hidden]> schrieb im Newsbeitrag
news:87bqphhxjl.fsf_at_pereiro.luannocracy.com...
> David Walthall <walthall_at_[hidden]> writes:
>
>> The only time I have found it useful to have default-constructed objects
>> that are otherwise unusable is when I need to store them in a map or
>> other container that requires a default constructible object.
>
> No standard containers have that requirement, though.
This seems to be another defect, as the standard also defines the following
constructor:
explicit vector(size_type n, const T& value = T(),
const Allocator& = Allocator());
Now how is the following code supposed to compile:
#include <vector>
struct X
{
X( int ) {}
};
void f()
{
// Error: No default constructor for X.
std::vector<X> v( 5 );
}
-- Matthias Hofmann Anvil-Soft, CEO http://www.anvil-soft.com - The Creators of Toilet Tycoon http://www.anvil-soft.de - Die Macher des Klomanagers
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