diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-04-28 11:40:47 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-10-01 20:34:46 +0100 |
commit | d335d73889d897d073b987b4323db05317fccad3 (patch) | |
tree | e0536e7e62fc3341f428a75ae3d09781efdeb7fb /gcc | |
parent | 681707ec28d56494fa61a80c62500724d55f8586 (diff) | |
download | gcc-d335d73889d897d073b987b4323db05317fccad3.zip gcc-d335d73889d897d073b987b4323db05317fccad3.tar.gz gcc-d335d73889d897d073b987b4323db05317fccad3.tar.bz2 |
libstdc++: Use conditional noexcept in std::reverse_iterator [PR 94418]
This adds a noexcept-specifier to each constructor and assignment
operator of std::reverse_iterator so that they are noexcept when the
corresponding operation on the underlying iterator is noexcept.
The std::reverse_iterator class template already requires that the
operations on the underlying type are valid, so we don't need to use the
std::is_nothrow_xxx traits to protect against errors when the expression
isn't even valid. We can just use a noexcept operator to test if the
expression can throw, without the overhead of redundantly checking if
the initialization/assignment would be valid.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/94418
* include/bits/stl_iterator.h (reverse_iterator): Use
conditional noexcept on constructors and assignment operators.
* testsuite/24_iterators/reverse_iterator/noexcept.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions