[cfe-commits] [libcxx] r136538 - in /libcxx/trunk/include/ext: hash_map hash_set
Sean Hunt
scshunt at csclub.uwaterloo.ca
Fri Jul 29 16:31:53 PDT 2011
Author: coppro
Date: Fri Jul 29 18:31:53 2011
New Revision: 136538
URL: http://llvm.org/viewvc/llvm-project?rev=136538&view=rev
Log:
Add two missing members from the extension hash containers. The first is
the type name 'data_type', which is specified by the SGI spec as being
the correct type name for the mapped type. The second is an overload of
insert found in standard containers, taking an iterator as a 'hint'
(which we ignore in the standard containers as well). libstdc++'s
implementation includes these overloads, and they are needed to make
insert_iterator work (which I suspect is the real motivation for
including them in the standard containers).
The motivation for including these overloads of insert and leaving the
mapped_type typedef is to make it easier for clients to migrate to the
standard containers.
Modified:
libcxx/trunk/include/ext/hash_map
libcxx/trunk/include/ext/hash_set
Modified: libcxx/trunk/include/ext/hash_map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ext/hash_map?rev=136538&r1=136537&r2=136538&view=diff
==============================================================================
--- libcxx/trunk/include/ext/hash_map (original)
+++ libcxx/trunk/include/ext/hash_map Fri Jul 29 18:31:53 2011
@@ -468,6 +468,7 @@
// types
typedef _Key key_type;
typedef _Tp mapped_type;
+ typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -551,6 +552,8 @@
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -744,6 +747,7 @@
// types
typedef _Key key_type;
typedef _Tp mapped_type;
+ typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -825,6 +829,8 @@
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
Modified: libcxx/trunk/include/ext/hash_set
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ext/hash_set?rev=136538&r1=136537&r2=136538&view=diff
==============================================================================
--- libcxx/trunk/include/ext/hash_set (original)
+++ libcxx/trunk/include/ext/hash_set Fri Jul 29 18:31:53 2011
@@ -274,6 +274,8 @@
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -492,6 +494,8 @@
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
More information about the cfe-commits
mailing list