[cfe-commits] [libcxx] r133402 - in /libcxx/trunk/include: map type_traits unordered_map
Howard Hinnant
hhinnant at apple.com
Sun Jun 19 14:45:00 PDT 2011
Author: hhinnant
Date: Sun Jun 19 16:45:00 2011
New Revision: 133402
URL: http://llvm.org/viewvc/llvm-project?rev=133402&view=rev
Log:
More fixes: One of my fixes to type_traits earlier today was incorrect, so that is reverted. Recently clang appears to have tightened up its definition of is_convertible and that has caused some failures in [unordered_][multi]map. I've switched to using is_constructible to restablish the desired functionality in [unordered_][multi]map. Specifically, inserting rvalues of move-only types for the keys.
Modified:
libcxx/trunk/include/map
libcxx/trunk/include/type_traits
libcxx/trunk/include/unordered_map
Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=133402&r1=133401&r2=133402&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Sun Jun 19 16:45:00 2011
@@ -869,7 +869,7 @@
emplace() {return __tree_.__emplace_unique();}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace(_A0&& __a0)
@@ -878,7 +878,7 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
pair<iterator, bool>
emplace(_A0&& __a0, _Args&& ...__args);
@@ -890,7 +890,7 @@
{return __tree_.__emplace_hint_unique(__p.__i_);}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
@@ -899,20 +899,20 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __p)
{return __tree_.__insert_unique(_STD::forward<_P>(__p));}
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_unique(__pos.__i_, _STD::forward<_P>(__p));}
@@ -995,11 +995,11 @@
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1309,7 +1309,7 @@
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
- class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
+ class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
@@ -1324,7 +1324,7 @@
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
- class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
+ class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
typename map<_Key, _Tp, _Compare, _Allocator>::iterator
map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
@@ -1601,7 +1601,7 @@
iterator emplace() {return __tree_.__emplace_multi();}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace(_A0&& __a0)
@@ -1610,7 +1610,7 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator
emplace(_A0&& __a0, _Args&& ...__args);
@@ -1621,7 +1621,7 @@
{return __tree_.__emplace_hint_multi(__p.__i_);}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
@@ -1630,20 +1630,20 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __p)
{return __tree_.__insert_multi(_STD::forward<_P>(__p));}
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_multi(__pos.__i_, _STD::forward<_P>(__p));}
@@ -1721,11 +1721,11 @@
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1761,7 +1761,7 @@
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0,
- class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
+ class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
@@ -1778,7 +1778,7 @@
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
- class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
+ class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
@@ -1799,7 +1799,7 @@
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
- class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
+ class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
@@ -1813,7 +1813,7 @@
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
- class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
+ class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=133402&r1=133401&r2=133402&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Sun Jun 19 16:45:00 2011
@@ -2939,7 +2939,7 @@
template <class ..._Args>
auto
__invoke(__any, _Args&& ...__args)
- -> __nat = delete;
+ -> __nat;
// bullets 1 and 2
Modified: libcxx/trunk/include/unordered_map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_map?rev=133402&r1=133401&r2=133402&view=diff
==============================================================================
--- libcxx/trunk/include/unordered_map (original)
+++ libcxx/trunk/include/unordered_map Sun Jun 19 16:45:00 2011
@@ -728,7 +728,7 @@
{return __table_.__emplace_unique();}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_A0&& __a0)
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0));}
@@ -736,7 +736,7 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
pair<iterator, bool> emplace(_A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -746,7 +746,7 @@
{return __table_.__emplace_unique().first;}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _A0&& __a0)
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0)).first;}
@@ -754,7 +754,7 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _A0&& __a0, _Args&&... __args)
{return emplace(_STD::forward<_A0>(__a0),
@@ -766,7 +766,7 @@
{return __table_.__insert_unique(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __x)
{return __table_.__insert_unique(_STD::forward<_P>(__x));}
@@ -776,7 +776,7 @@
{return insert(__x).first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, _P&& __x)
{return insert(_STD::forward<_P>(__x)).first;}
@@ -869,11 +869,11 @@
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(const key_type& __k);
@@ -1037,7 +1037,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
- class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
+ class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
@@ -1058,7 +1058,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0,
- class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
+ class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
>
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
@@ -1076,7 +1076,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
- class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
+ class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
pair<typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args)
@@ -1332,7 +1332,7 @@
{return __table_.__emplace_multi();}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_A0&& __a0)
{return __table_.__emplace_multi(_STD::forward<_A0>(__a0));}
@@ -1340,7 +1340,7 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator emplace(_A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -1350,7 +1350,7 @@
{return __table_.__emplace_hint_multi(__p.__i_);}
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _A0&& __a0)
{return __table_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
@@ -1358,7 +1358,7 @@
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator emplace_hint(const_iterator __p, _A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1366,7 +1366,7 @@
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __x)
{return __table_.__insert_multi(_STD::forward<_P>(__x));}
@@ -1376,7 +1376,7 @@
{return __table_.__insert_multi(__p.__i_, __x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
- class = typename enable_if<is_convertible<_P, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, _P&& __x)
{return __table_.__insert_multi(__p.__i_, _STD::forward<_P>(__x));}
@@ -1461,10 +1461,10 @@
private:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _A0, class... _Args,
- class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
+ class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&&... __args);
template <class _A0,
- class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
+ class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0);
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
};
@@ -1628,7 +1628,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
- class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
+ class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
@@ -1649,7 +1649,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0,
- class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
+ class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
>
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
@@ -1667,7 +1667,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
- class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
+ class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args)
@@ -1681,7 +1681,7 @@
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
- class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
+ class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint(
More information about the cfe-commits
mailing list