Add noexcept to generic std::size, std::empty and std::data

Backport from mainline
2017-11-15  Jonathan Wakely  <jwakely@redhat.com>

	* include/bits/range_access.h (size, empty, data): Add conditional
	noexcept to generic overloads.

From-SVN: r255326
This commit is contained in:
Jonathan Wakely 2017-12-01 17:12:11 +00:00 committed by Jonathan Wakely
parent e737fc0cba
commit c210258bae
2 changed files with 15 additions and 5 deletions

View File

@ -1,5 +1,11 @@
2017-12-01 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
2017-11-15 Jonathan Wakely <jwakely@redhat.com>
* include/bits/range_access.h (size, empty, data): Add conditional
noexcept to generic overloads.
Backport from mainline
2017-10-24 Jonathan Wakely <jwakely@redhat.com>

View File

@ -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 <typename _Container>
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 <typename _Container>
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 <typename _Container>
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 <typename _Container>
constexpr auto
data(const _Container& __cont) -> decltype(__cont.data())
data(const _Container& __cont) noexcept(noexcept(__cont.data()))
-> decltype(__cont.data())
{ return __cont.data(); }
/**