I noticed that requirements of std::vector on its elememt type T changed from C++03 to C++0x. T now does not need to be copy constructible anymore, but move constructibility suffices.
Is it required for T even if we don't potentially reallocate?
vector<boost::scoped_ptr<int>> x(numberElements);
I don't see a need for a move here. What does the specification say?
According to 23.3.6.2 [vector.cons] paragraph 4 the constructor you are using requires DefaultInsertable. Since the constructor isn't one of the constructors for the requirements table also asking for CopyInsertable there shouldn't be any additional requirements. According to 23.2.1 [container.requirements.general] paragraph 13, DefaultInsertable means that the following expression is well-formed:
allocator_traits<A>::construct(m, p);
It seems, this means that the answer depends on the used allocator A. I don't quite fancy to analyze the deeper meaning of 20.6.7.2 [allocator.uses.construction]. Let's do the instructor escape: Determining what this paragraph means is left as an exercise!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With