SCARY/N2913 iterator support between the multi and non-multi versions of the associative and unordered containers. I beleive lack of support for this was accidentally recently introduced (by me) and this is fixing a regression. This time tests are put in to prevent such a regression in the future.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191692 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
156
include/map
156
include/map
@@ -575,6 +575,75 @@ template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class multimap;
|
||||
template <class _TreeIterator> class __map_const_iterator;
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
union __value_type
|
||||
{
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef pair<key_type, mapped_type> __nc_value_type;
|
||||
|
||||
value_type __cc;
|
||||
__nc_value_type __nc;
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type(_Args&& ...__args)
|
||||
: __cc(std::forward<_Args>(__args)...) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type(const __value_type& __v)
|
||||
: __cc(__v.__cc) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type(__value_type& __v)
|
||||
: __cc(__v.__cc) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type(__value_type&& __v)
|
||||
: __nc(std::move(__v.__nc)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type& operator=(const __value_type& __v)
|
||||
{__nc = __v.__cc; return *this;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type& operator=(__value_type&& __v)
|
||||
{__nc = std::move(__v.__nc); return *this;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__value_type() {__cc.~value_type();}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
struct __value_type
|
||||
{
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
|
||||
value_type __cc;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type() {}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type(const _A0& __a0)
|
||||
: __cc(__a0) {}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type(const _A0& __a0, const _A1& __a1)
|
||||
: __cc(__a0, __a1) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class _TreeIterator>
|
||||
class _LIBCPP_TYPE_VIS_ONLY __map_iterator
|
||||
{
|
||||
@@ -740,49 +809,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
union __value_type
|
||||
{
|
||||
typedef typename map::value_type value_type;
|
||||
typedef typename map::__nc_value_type __nc_value_type;
|
||||
value_type __cc;
|
||||
__nc_value_type __nc;
|
||||
|
||||
template <class ..._Args>
|
||||
__value_type(_Args&& ...__args)
|
||||
: __cc(std::forward<_Args>(__args)...) {}
|
||||
|
||||
__value_type(const __value_type& __v)
|
||||
: __cc(__v.__cc) {}
|
||||
|
||||
__value_type(__value_type&& __v)
|
||||
: __nc(std::move(__v.__nc)) {}
|
||||
|
||||
__value_type& operator=(const __value_type& __v)
|
||||
{__nc = __v.__cc; return *this;}
|
||||
|
||||
__value_type& operator=(__value_type&& __v)
|
||||
{__nc = std::move(__v.__nc); return *this;}
|
||||
|
||||
~__value_type() {__cc.~value_type();}
|
||||
};
|
||||
#else
|
||||
struct __value_type
|
||||
{
|
||||
typedef typename map::value_type value_type;
|
||||
value_type __cc;
|
||||
|
||||
__value_type() {}
|
||||
|
||||
template <class _A0>
|
||||
__value_type(const _A0& __a0)
|
||||
: __cc(__a0) {}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
__value_type(const _A0& __a0, const _A1& __a1)
|
||||
: __cc(__a0, __a1) {}
|
||||
};
|
||||
#endif
|
||||
typedef _VSTD::__value_type<key_type, mapped_type> __value_type;
|
||||
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
@@ -1512,49 +1539,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
#if __cplusplus >= 201103L
|
||||
union __value_type
|
||||
{
|
||||
typedef typename multimap::value_type value_type;
|
||||
typedef typename multimap::__nc_value_type __nc_value_type;
|
||||
value_type __cc;
|
||||
__nc_value_type __nc;
|
||||
|
||||
template <class ..._Args>
|
||||
__value_type(_Args&& ...__args)
|
||||
: __cc(std::forward<_Args>(__args)...) {}
|
||||
|
||||
__value_type(const __value_type& __v)
|
||||
: __cc(std::move(__v.__cc)) {}
|
||||
|
||||
__value_type(__value_type&& __v)
|
||||
: __nc(std::move(__v.__nc)) {}
|
||||
|
||||
__value_type& operator=(const __value_type& __v)
|
||||
{__nc = __v.__cc; return *this;}
|
||||
|
||||
__value_type& operator=(__value_type&& __v)
|
||||
{__nc = std::move(__v.__nc); return *this;}
|
||||
|
||||
~__value_type() {__cc.~value_type();}
|
||||
};
|
||||
#else
|
||||
struct __value_type
|
||||
{
|
||||
typedef typename multimap::value_type value_type;
|
||||
value_type __cc;
|
||||
|
||||
__value_type() {}
|
||||
|
||||
template <class _A0>
|
||||
__value_type(const _A0& __a0)
|
||||
: __cc(__a0) {}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
__value_type(const _A0& __a0, const _A1& __a1)
|
||||
: __cc(__a0, __a1) {}
|
||||
};
|
||||
#endif
|
||||
typedef _VSTD::__value_type<key_type, mapped_type> __value_type;
|
||||
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
Reference in New Issue
Block a user