(Assuming allocator's default constructor does not throw)
Boost implementation of Deque says:
Throws if allocator_type's default constructor throws
What does C++ standard specify ?
Thanks
(Assuming allocator's default constructor does not throw)
Boost implementation of Deque says:
Throws if allocator_type's default constructor throws
What does C++ standard specify ?
Thanks
The C++11 Standard (Paragraph 23.3.3.2) specifies:
explicit deque(const Allocator& = Allocator());
1 Effects: Constructs an empty deque, using the specified allocator.
2 Complexity: Constant.
That's it. No mention is made of the conditions under which this constructor may or may not throw, nor does Clause 23 (dedicated to sequence containers) specify any general exception safety guarantees, and the constructor itself is not marked as (conditionally) noexcept
.
Therefore, one must just assume it can throw.
std::allocator
s requirements make its constructors noexcept
, as it says shall not exit via an exception
. However, the deque's constructor can throw as it is not noexcept
.