libstdc++: Add conditional noexcept to remaining range access functions
Add conditional noexcept to the remaining range access functions that were not changed in r15-5669-g8692cb10e82e72. This is now being proposed for C++26 by P3623R0 (not published yet). libstdc++-v3/ChangeLog: * include/bits/range_access.h (rbegin, rend, crbegin, crend): Add conditional noexcept, as per P3623R0. * testsuite/24_iterators/headers/iterator/range_access.cc: Add noexcept-specifier to rbegin, rend, crbegin and crend declarations.
This commit is contained in:
parent
08f70200ce
commit
7bc72a3d20
2 changed files with 23 additions and 17 deletions
|
@ -153,7 +153,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Container>
|
||||
[[__nodiscard__, __gnu__::__always_inline__]]
|
||||
inline _GLIBCXX17_CONSTEXPR auto
|
||||
rbegin(_Container& __cont) -> decltype(__cont.rbegin())
|
||||
rbegin(_Container& __cont) noexcept(noexcept(__cont.rbegin()))
|
||||
-> decltype(__cont.rbegin())
|
||||
{ return __cont.rbegin(); }
|
||||
|
||||
/**
|
||||
|
@ -164,7 +165,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Container>
|
||||
[[__nodiscard__, __gnu__::__always_inline__]]
|
||||
inline _GLIBCXX17_CONSTEXPR auto
|
||||
rbegin(const _Container& __cont) -> decltype(__cont.rbegin())
|
||||
rbegin(const _Container& __cont) noexcept(noexcept(__cont.rbegin()))
|
||||
-> decltype(__cont.rbegin())
|
||||
{ return __cont.rbegin(); }
|
||||
|
||||
/**
|
||||
|
@ -175,7 +177,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Container>
|
||||
[[__nodiscard__, __gnu__::__always_inline__]]
|
||||
inline _GLIBCXX17_CONSTEXPR auto
|
||||
rend(_Container& __cont) -> decltype(__cont.rend())
|
||||
rend(_Container& __cont) noexcept(noexcept(__cont.rend()))
|
||||
-> decltype(__cont.rend())
|
||||
{ return __cont.rend(); }
|
||||
|
||||
/**
|
||||
|
@ -186,7 +189,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Container>
|
||||
[[__nodiscard__, __gnu__::__always_inline__]]
|
||||
inline _GLIBCXX17_CONSTEXPR auto
|
||||
rend(const _Container& __cont) -> decltype(__cont.rend())
|
||||
rend(const _Container& __cont) noexcept(noexcept(__cont.rend()))
|
||||
-> decltype(__cont.rend())
|
||||
{ return __cont.rend(); }
|
||||
|
||||
/**
|
||||
|
@ -241,7 +245,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Container>
|
||||
[[__nodiscard__, __gnu__::__always_inline__]]
|
||||
inline _GLIBCXX17_CONSTEXPR auto
|
||||
crbegin(const _Container& __cont) -> decltype(std::rbegin(__cont))
|
||||
crbegin(const _Container& __cont) noexcept(noexcept(std::rbegin(__cont)))
|
||||
-> decltype(std::rbegin(__cont))
|
||||
{ return std::rbegin(__cont); }
|
||||
|
||||
/**
|
||||
|
@ -252,7 +257,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Container>
|
||||
[[__nodiscard__, __gnu__::__always_inline__]]
|
||||
inline _GLIBCXX17_CONSTEXPR auto
|
||||
crend(const _Container& __cont) -> decltype(std::rend(__cont))
|
||||
crend(const _Container& __cont) noexcept(noexcept(std::rend(__cont)))
|
||||
-> decltype(std::rend(__cont))
|
||||
{ return std::rend(__cont); }
|
||||
|
||||
#endif // C++14
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#ifdef _GLIBCXX_RELEASE
|
||||
// Conditional noexcept on these functions is a libstdc++ extension
|
||||
# define NOTHROW(F) noexcept(noexcept(c.F()))
|
||||
# define NOTHROW(F) noexcept(noexcept(F))
|
||||
#else
|
||||
# define NOTHROW(F)
|
||||
#endif
|
||||
|
@ -42,17 +42,17 @@ namespace std
|
|||
{
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
begin(C& c) NOTHROW(begin) -> decltype(c.begin());
|
||||
begin(C& c) NOTHROW(c.begin()) -> decltype(c.begin());
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
begin(const C& c) NOTHROW(begin) -> decltype(c.begin());
|
||||
begin(const C& c) NOTHROW(c.begin()) -> decltype(c.begin());
|
||||
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
end(C& c) NOTHROW(end) -> decltype(c.end());
|
||||
end(C& c) NOTHROW(c.end()) -> decltype(c.end());
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
end(const C& c) NOTHROW(end) -> decltype(c.end());
|
||||
end(const C& c) NOTHROW(c.end()) -> decltype(c.end());
|
||||
|
||||
template<class T, size_t N>
|
||||
CONSTEXPR_14 T*
|
||||
|
@ -71,17 +71,17 @@ namespace std
|
|||
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
rbegin(C& c) -> decltype(c.rbegin());
|
||||
rbegin(C& c) NOTHROW(c.rbegin()) -> decltype(c.rbegin());
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
rbegin(const C& c) -> decltype(c.rbegin());
|
||||
rbegin(const C& c) NOTHROW(c.rbegin()) -> decltype(c.rbegin());
|
||||
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
rend(C& c) -> decltype(c.rend());
|
||||
rend(C& c) NOTHROW(c.rend()) -> decltype(c.rend());
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
rend(const C& c) -> decltype(c.rend());
|
||||
rend(const C& c) NOTHROW(c.rend()) -> decltype(c.rend());
|
||||
|
||||
template<class T, size_t N>
|
||||
CONSTEXPR_17 reverse_iterator<T*>
|
||||
|
@ -99,9 +99,9 @@ namespace std
|
|||
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
crbegin(const C& c) -> decltype(std::rbegin(c));
|
||||
crbegin(const C& c) NOTHROW(std::rbegin(c)) -> decltype(std::rbegin(c));
|
||||
template<class C>
|
||||
CONSTEXPR_17 auto
|
||||
cend(const C& c) -> decltype(std::rend(c));
|
||||
cend(const C& c) NOTHROW(std::rend(c)) -> decltype(std::rend(c));
|
||||
#endif // C++14
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue