diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-07-30 21:04:42 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-07-30 21:04:42 +0000 |
| commit | 4c80bfbd53cafa3690ba5c65459cf6cfc560e2e3 (patch) | |
| tree | 3ce5e9c83da7ba999b7fa8546196f4060a8f1d4e /libcxx/include/unordered_map | |
| parent | b7d5409ad292f54def13989d868f2536713d6ece (diff) | |
| download | bcm5719-llvm-4c80bfbd53cafa3690ba5c65459cf6cfc560e2e3.tar.gz bcm5719-llvm-4c80bfbd53cafa3690ba5c65459cf6cfc560e2e3.zip | |
Debug mode for unordered_multimap. Some mods were done for unordered_map as well to keep all the tests passing. However unordered_map is at the very least still missing tests, if not functionality (if it isn't tested, it probably isn't working).
llvm-svn: 187446
Diffstat (limited to 'libcxx/include/unordered_map')
| -rw-r--r-- | libcxx/include/unordered_map | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index 55db2f5f584..eebf2f5ea61 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -801,8 +801,18 @@ public: template <class... _Args> _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator emplace_hint(const_iterator __p, _Args&&... __args) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not" + " referring to this unordered_map"); + return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; + } +#else iterator emplace_hint(const_iterator, _Args&&... __args) {return emplace(_VSTD::forward<_Args>(__args)...).first;} +#endif #endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY @@ -816,14 +826,34 @@ public: {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator insert(const_iterator __p, const value_type& __x) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" + " referring to this unordered_map"); + return insert(__x).first; + } +#else iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;} +#endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator insert(const_iterator __p, _Pp&& __x) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_map::insert(const_iterator, value_type&&) called with an iterator not" + " referring to this unordered_map"); + return insert(_VSTD::forward<_Pp>(__x)).first; + } +#else iterator insert(const_iterator, _Pp&& __x) {return insert(_VSTD::forward<_Pp>(__x)).first;} +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _InputIterator> void insert(_InputIterator __first, _InputIterator __last); @@ -1047,6 +1077,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); + __get_db()->swap(this, &__u); #endif } @@ -1066,6 +1097,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( _VSTD::move(__u.__table_.remove((__i++).__i_)->__value_) ); } +#if _LIBCPP_DEBUG_LEVEL >= 2 + else + __get_db()->swap(this, &__u); +#endif } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1754,6 +1789,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); + __get_db()->swap(this, &__u); #endif } @@ -1775,6 +1811,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( ); } } +#if _LIBCPP_DEBUG_LEVEL >= 2 + else + __get_db()->swap(this, &__u); +#endif } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |

