diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2015-07-13 20:04:56 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2015-07-13 20:04:56 +0000 |
| commit | e3fbe1433b02d52a833b06219184ee4f4852b50a (patch) | |
| tree | b1be725f7d35363bf0681fd6fd3f4938fe0a37d5 /libcxx/include/unordered_map | |
| parent | 75a7e435813d28751f9555a11dd171e389be2d1e (diff) | |
| download | bcm5719-llvm-e3fbe1433b02d52a833b06219184ee4f4852b50a.tar.gz bcm5719-llvm-e3fbe1433b02d52a833b06219184ee4f4852b50a.zip | |
Implement the first part of N4258: 'Cleaning up noexcept in the Library'. This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates.
llvm-svn: 242056
Diffstat (limited to 'libcxx/include/unordered_map')
| -rw-r--r-- | libcxx/include/unordered_map | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index fe20bdb6475..cf70ab62f69 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -401,6 +401,12 @@ public: _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return static_cast<const _Hash&>(*this)(__x);} + void swap(__unordered_map_hasher&__y) + _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) + { + using _VSTD::swap; + swap(static_cast<const _Hash&>(*this), static_cast<const _Hash&>(__y)); + } }; template <class _Key, class _Cp, class _Hash> @@ -425,8 +431,24 @@ public: _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return __hash_(__x);} + void swap(__unordered_map_hasher&__y) + _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) + { + using _VSTD::swap; + swap(__hash_, __y.__hash_); + } }; +template <class _Key, class _Cp, class _Hash, bool __b> +inline _LIBCPP_INLINE_VISIBILITY +void +swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x, + __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y) + _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) +{ + __x.swap(__y); +} + template <class _Key, class _Cp, class _Pred, bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value > @@ -453,6 +475,12 @@ public: _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const {return static_cast<const _Pred&>(*this)(__x, __y.__cc.first);} + void swap(__unordered_map_equal&__y) + _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) + { + using _VSTD::swap; + swap(static_cast<const _Pred&>(*this), static_cast<const _Pred&>(__y)); + } }; template <class _Key, class _Cp, class _Pred> @@ -480,8 +508,24 @@ public: _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const {return __pred_(__x, __y.__cc.first);} + void swap(__unordered_map_equal&__y) + _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) + { + using _VSTD::swap; + swap(__pred_, __y.__pred_); + } }; +template <class _Key, class _Cp, class _Pred, bool __b> +inline _LIBCPP_INLINE_VISIBILITY +void +swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x, + __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y) + _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) +{ + __x.swap(__y); +} + template <class _Alloc> class __hash_map_node_destructor { |

