Commit 19491228 by Jonathan Wakely Committed by Jonathan Wakely

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
parent bd9cc42b
2017-11-15 Jonathan Wakely <jwakely@redhat.com>
* include/bits/range_access.h (size, empty, data): Add conditional
noexcept to generic overloads.
2017-11-14 Ville Voutilainen <ville.voutilainen@gmail.com> 2017-11-14 Ville Voutilainen <ville.voutilainen@gmail.com>
Implement LWG 2733 and LWG 2759 Implement LWG 2733 and LWG 2759
......
...@@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif // C++14 #endif // C++14
#if __cplusplus > 201402L #if __cplusplus >= 201703L
#define __cpp_lib_nonmember_container_access 201411 #define __cpp_lib_nonmember_container_access 201411
/** /**
...@@ -239,7 +239,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -239,7 +239,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template <typename _Container> template <typename _Container>
constexpr auto constexpr auto
size(const _Container& __cont) -> decltype(__cont.size()) size(const _Container& __cont) noexcept(noexcept(__cont.size()))
-> decltype(__cont.size())
{ return __cont.size(); } { return __cont.size(); }
/** /**
...@@ -257,7 +258,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -257,7 +258,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template <typename _Container> template <typename _Container>
constexpr auto constexpr auto
empty(const _Container& __cont) -> decltype(__cont.empty()) empty(const _Container& __cont) noexcept(noexcept(__cont.empty()))
-> decltype(__cont.empty())
{ return __cont.empty(); } { return __cont.empty(); }
/** /**
...@@ -284,7 +286,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -284,7 +286,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template <typename _Container> template <typename _Container>
constexpr auto constexpr auto
data(_Container& __cont) -> decltype(__cont.data()) data(_Container& __cont) noexcept(noexcept(__cont.data()))
-> decltype(__cont.data())
{ return __cont.data(); } { return __cont.data(); }
/** /**
...@@ -293,7 +296,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -293,7 +296,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template <typename _Container> template <typename _Container>
constexpr auto constexpr auto
data(const _Container& __cont) -> decltype(__cont.data()) data(const _Container& __cont) noexcept(noexcept(__cont.data()))
-> decltype(__cont.data())
{ return __cont.data(); } { return __cont.data(); }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment