Topic: Defect report: missing exception specifications for vector::resize(size_type sz)
Author: Rani Sharoni <ranisharoni75@gmail.com>
Date: Tue, 29 Mar 2011 13:07:54 CST Raw View
In C++1x (N3090) there are two version of vector::resize - 23.3.6:
void resize(size_type sz);
void resize(size_type sz, const T& c);
The text in 23.3.6.2/12 only mentions "no effects on throw" for the
two args version of resize:
Requires: If an exception is thrown other than by the move constructor
of a non-CopyConstructible T there are no effects.
This seems like unintentional oversight since resize(size) is
semantically the same as resize(size, T()).
Additionally, the C++03 standard only specify single version of resize
with default for the second argument - 23.2.4:
void resize(size_type sz, T c = T());
Therefore not requiring same guarantees for both version of resize is
in fact a regression.
Rani
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@googlemail.com>
Date: Wed, 30 Mar 2011 13:05:39 CST Raw View
Am 29.03.2011 21:07, schrieb Rani Sharoni:
>
> In C++1x (N3090) there are two version of vector::resize - 23.3.6:
> void resize(size_type sz);
> void resize(size_type sz, const T& c);
>
> The text in 23.3.6.2/12 only mentions "no effects on throw" for the
> two args version of resize:
> Requires: If an exception is thrown other than by the move constructor
> of a non-CopyConstructible T there are no effects.
>
> This seems like unintentional oversight since resize(size) is
> semantically the same as resize(size, T()).
> Additionally, the C++03 standard only specify single version of resize
> with default for the second argument - 23.2.4:
> void resize(size_type sz, T c = T());
>
> Therefore not requiring same guarantees for both version of resize is
> in fact a regression.
Nikolay Ivchenkov has reported a related issue, see
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2033
It seems to me that this issue should be used to solve your mentioned
problem as well. Your remark will be forwarded to the library working
group.
Greetings from Bremen,
Daniel Kr gler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]