Ian Collins
unread,Apr 6, 2017, 8:41:54 PM4/6/17You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
On 04/ 7/17 12:34 PM, Stefan Ram wrote:
> It is conceivably, that when a vector is allocated or the
> »push_back« member function is called, (dynamic) memory is
> missing to accomplish the intention of that call.
>
> Where does the standard specify behavior for this?
>
> In 17.5.5.12p4 (was: 17.6.5.12p4) there is a sentence saying:
>
> »Any other functions defined in the C++ standard library
> that do not have an exception-specification may throw
> implementation-defined exceptions unless otherwise specified.«
>
> This should allow to throw an exception in the case of
> missing memory. But is this the most specific sentence
> about the behavior of »push_back« (and similar functions)
> in the case of lack of (dynamic) memory in the standard?
By implication (push_back may call new), throwing std::bad_alloc.
--
Ian