Fix ::reference typedef in insert iterators.

Since at least the C++11 standard insert iterators are specified
as having ::reference typedef void. Libc++ was not doing that.
This patch corrects the typedef.

This patch changes the std::iterator base class of insert_iterator,
front_insert_iterator and back_insert_iterator. This should not
be an ABI breaking change.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274209 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-06-30 04:40:50 +00:00
parent 8db06d71c2
commit c848cefa27
4 changed files with 12 additions and 12 deletions

View File

@@ -149,7 +149,7 @@ public:
typedef Container container_type;
typedef void value_type;
typedef void difference_type;
typedef back_insert_iterator<Cont>& reference;
typedef void reference;
typedef void pointer;
explicit back_insert_iterator(Container& x);
@@ -170,7 +170,7 @@ public:
typedef Container container_type;
typedef void value_type;
typedef void difference_type;
typedef front_insert_iterator<Cont>& reference;
typedef void reference;
typedef void pointer;
explicit front_insert_iterator(Container& x);
@@ -192,7 +192,7 @@ public:
typedef Container container_type;
typedef void value_type;
typedef void difference_type;
typedef insert_iterator<Cont>& reference;
typedef void reference;
typedef void pointer;
insert_iterator(Container& x, typename Container::iterator i);
@@ -663,7 +663,7 @@ class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator
void,
void,
void,
back_insert_iterator<_Container>&>
void>
{
protected:
_Container* container;
@@ -696,7 +696,7 @@ class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator
void,
void,
void,
front_insert_iterator<_Container>&>
void>
{
protected:
_Container* container;
@@ -729,7 +729,7 @@ class _LIBCPP_TYPE_VIS_ONLY insert_iterator
void,
void,
void,
insert_iterator<_Container>&>
void>
{
protected:
_Container* container;

View File

@@ -21,7 +21,7 @@
// typedef Cont container_type;
// typedef void value_type;
// typedef void difference_type;
// typedef back_insert_iterator<Cont>& reference;
// typedef void reference;
// typedef void pointer;
// };
@@ -48,7 +48,7 @@ test()
static_assert((std::is_same<typename R::container_type, C>::value), "");
static_assert((std::is_same<typename R::value_type, void>::value), "");
static_assert((std::is_same<typename R::difference_type, void>::value), "");
static_assert((std::is_same<typename R::reference, R&>::value), "");
static_assert((std::is_same<typename R::reference, void>::value), "");
static_assert((std::is_same<typename R::pointer, void>::value), "");
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
}

View File

@@ -21,7 +21,7 @@
// typedef Container container_type;
// typedef void value_type;
// typedef void difference_type;
// typedef front_insert_iterator<Cont>& reference;
// typedef void reference;
// typedef void pointer;
// typedef output_iterator_tag iterator_category;
// };
@@ -49,7 +49,7 @@ test()
static_assert((std::is_same<typename R::container_type, C>::value), "");
static_assert((std::is_same<typename R::value_type, void>::value), "");
static_assert((std::is_same<typename R::difference_type, void>::value), "");
static_assert((std::is_same<typename R::reference, R&>::value), "");
static_assert((std::is_same<typename R::reference, void>::value), "");
static_assert((std::is_same<typename R::pointer, void>::value), "");
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
}

View File

@@ -22,7 +22,7 @@
// typedef Cont container_type;
// typedef void value_type;
// typedef void difference_type;
// typedef insert_iterator<Cont>& reference;
// typedef void reference;
// typedef void pointer;
// };
@@ -53,7 +53,7 @@ test()
static_assert((std::is_same<typename R::container_type, C>::value), "");
static_assert((std::is_same<typename R::value_type, void>::value), "");
static_assert((std::is_same<typename R::difference_type, void>::value), "");
static_assert((std::is_same<typename R::reference, R&>::value), "");
static_assert((std::is_same<typename R::reference, void>::value), "");
static_assert((std::is_same<typename R::pointer, void>::value), "");
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
}