Add noexcept to operator[] for array and deque. This is an extension. We already do this for string and string_view. This should give better codegen inside of noexcept functions.
llvm-svn: 356209
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 5f6a5ac19cddda2fbc67582d6b12a92493e60b4e
diff --git a/include/array b/include/array
index 05c4b65..320bfd5 100644
--- a/include/array
+++ b/include/array
@@ -190,9 +190,9 @@
// element access:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
- reference operator[](size_type __n) {return __elems_[__n];}
+ reference operator[](size_type __n) _NOEXCEPT {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
- const_reference operator[](size_type __n) const {return __elems_[__n];}
+ const_reference operator[](size_type __n) const _NOEXCEPT {return __elems_[__n];}
_LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n);
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
@@ -303,13 +303,13 @@
// element access:
_LIBCPP_INLINE_VISIBILITY
- reference operator[](size_type) {
+ reference operator[](size_type) _NOEXCEPT {
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
_LIBCPP_UNREACHABLE();
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
- const_reference operator[](size_type) const {
+ const_reference operator[](size_type) const _NOEXCEPT {
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
_LIBCPP_UNREACHABLE();
}