From: Jonathan Wakely Date: Wed, 15 Nov 2017 17:50:42 +0000 (+0000) Subject: Add noexcept to generic std::size, std::empty and std::data X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1949122881af310b7b0177105d515d62e59a630b;p=gcc.git Add noexcept to generic std::size, std::empty and std::data * include/bits/range_access.h (size, empty, data): Add conditional noexcept to generic overloads. From-SVN: r254779 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index dc152b36b5c..5f0bcca83be 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2017-11-15 Jonathan Wakely + + * include/bits/range_access.h (size, empty, data): Add conditional + noexcept to generic overloads. + 2017-11-14 Ville Voutilainen Implement LWG 2733 and LWG 2759 diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h index 3987c2addf1..2a037ad8082 100644 --- a/libstdc++-v3/include/bits/range_access.h +++ b/libstdc++-v3/include/bits/range_access.h @@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++14 -#if __cplusplus > 201402L +#if __cplusplus >= 201703L #define __cpp_lib_nonmember_container_access 201411 /** @@ -239,7 +239,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template constexpr auto - size(const _Container& __cont) -> decltype(__cont.size()) + size(const _Container& __cont) noexcept(noexcept(__cont.size())) + -> decltype(__cont.size()) { return __cont.size(); } /** @@ -257,7 +258,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template constexpr auto - empty(const _Container& __cont) -> decltype(__cont.empty()) + empty(const _Container& __cont) noexcept(noexcept(__cont.empty())) + -> decltype(__cont.empty()) { return __cont.empty(); } /** @@ -284,7 +286,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template constexpr auto - data(_Container& __cont) -> decltype(__cont.data()) + data(_Container& __cont) noexcept(noexcept(__cont.data())) + -> decltype(__cont.data()) { return __cont.data(); } /** @@ -293,7 +296,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template constexpr auto - data(const _Container& __cont) -> decltype(__cont.data()) + data(const _Container& __cont) noexcept(noexcept(__cont.data())) + -> decltype(__cont.data()) { return __cont.data(); } /**