[libcxx] r258625 - Revert "unordered_map: Reuse insert logic in emplace when possible, NFC"

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 23 07:12:48 PST 2016


Author: dexonsmith
Date: Sat Jan 23 09:12:47 2016
New Revision: 258625

URL: http://llvm.org/viewvc/llvm-project?rev=258625&view=rev
Log:
Revert "unordered_map: Reuse insert logic in emplace when possible, NFC"

This reverts commit r258575.  EricWF sent me an email (no link since it
was off-list) requesting to review this pre-commit instead of
post-commit.

Modified:
    libcxx/trunk/include/unordered_map

Modified: libcxx/trunk/include/unordered_map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_map?rev=258625&r1=258624&r2=258625&view=diff
==============================================================================
--- libcxx/trunk/include/unordered_map (original)
+++ libcxx/trunk/include/unordered_map Sat Jan 23 09:12:47 2016
@@ -922,32 +922,8 @@ public:
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template <class... _Args>
-    pair<iterator, bool> emplace(_Args&&... __args)
-        {return __emplace_dispatch(std::forward<_Args>(__args)...);}
+        pair<iterator, bool> emplace(_Args&&... __args);
 
-private:
-    template <class _Arg>
-    pair<iterator, bool> __emplace_dispatch(_Arg&& __arg)
-        {
-            typedef is_constructible<value_type, _Arg> __constructible;
-            return __emplace_insert_if_constructible(std::forward<_Arg>(__arg),
-                                                     __constructible());
-        }
-    template <class _Arg1, class... _Args>
-    pair<iterator, bool> __emplace_dispatch(_Arg1&& __arg1, _Args&&... __args)
-        {return __emplace_impl(std::forward<_Arg1>(__arg1), std::forward<_Args>(__args)...);}
-
-    template <class _Arg>
-    pair<iterator, bool> __emplace_insert_if_constructible(_Arg&& __arg, false_type)
-        {return __emplace_impl(std::forward<_Arg>(__arg));}
-    template <class _Arg>
-    pair<iterator, bool> __emplace_insert_if_constructible(_Arg&& __arg, true_type)
-        {return insert(std::forward<_Arg>(__arg));}
-
-    template <class... _Args>
-    pair<iterator, bool> __emplace_impl(_Args&&... __args);
-
-public:
     template <class... _Args>
         _LIBCPP_INLINE_VISIBILITY
 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -956,7 +932,7 @@ public:
             _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 emplace(_VSTD::forward<_Args>(__args)...).first;
+            return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
         }
 #else
         iterator emplace_hint(const_iterator, _Args&&... __args)
@@ -1501,7 +1477,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 template <class... _Args>
 pair<typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__emplace_impl(_Args&&... __args)
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args)
 {
     __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
     pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());




More information about the cfe-commits mailing list