[libcxx] r184358 - Implement full support for non-pointer types in custom allocators. This is for the associative containers only. This work still needs to be done on the unordered and sequence containers. Fixes http://llvm.org/bugs/show_bug.cgi?id=15978
Howard Hinnant
hhinnant at apple.com
Wed Jun 19 14:29:41 PDT 2013
Author: hhinnant
Date: Wed Jun 19 16:29:40 2013
New Revision: 184358
URL: http://llvm.org/viewvc/llvm-project?rev=184358&view=rev
Log:
Implement full support for non-pointer types in custom allocators. This is for the associative containers only. This work still needs to be done on the unordered and sequence containers. Fixes http://llvm.org/bugs/show_bug.cgi?id=15978
Added:
libcxx/trunk/test/containers/min_allocator.h
Modified:
libcxx/trunk/include/__tree
libcxx/trunk/include/map
libcxx/trunk/test/containers/associative/map/map.access/at.pass.cpp
libcxx/trunk/test/containers/associative/map/map.access/empty.pass.cpp
libcxx/trunk/test/containers/associative/map/map.access/index_key.pass.cpp
libcxx/trunk/test/containers/associative/map/map.access/index_rv_key.pass.cpp
libcxx/trunk/test/containers/associative/map/map.access/iterator.pass.cpp
libcxx/trunk/test/containers/associative/map/map.access/max_size.pass.cpp
libcxx/trunk/test/containers/associative/map/map.access/size.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/compare.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/copy.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/copy_alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/copy_assign.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/default.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/default_recursive.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/move.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/move_alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/move_assign.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/clear.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/emplace.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/erase_key.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
libcxx/trunk/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp
libcxx/trunk/test/containers/associative/map/map.ops/count.pass.cpp
libcxx/trunk/test/containers/associative/map/map.ops/equal_range.pass.cpp
libcxx/trunk/test/containers/associative/map/map.ops/find.pass.cpp
libcxx/trunk/test/containers/associative/map/map.ops/lower_bound.pass.cpp
libcxx/trunk/test/containers/associative/map/map.ops/upper_bound.pass.cpp
libcxx/trunk/test/containers/associative/map/map.special/member_swap.pass.cpp
libcxx/trunk/test/containers/associative/map/map.special/non_member_swap.pass.cpp
libcxx/trunk/test/containers/associative/map/types.pass.cpp
libcxx/trunk/test/containers/associative/multimap/empty.pass.cpp
libcxx/trunk/test/containers/associative/multimap/iterator.pass.cpp
libcxx/trunk/test/containers/associative/multimap/max_size.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/default.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/move.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.ops/count.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.ops/find.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
libcxx/trunk/test/containers/associative/multimap/size.pass.cpp
libcxx/trunk/test/containers/associative/multimap/types.pass.cpp
libcxx/trunk/test/containers/associative/multiset/clear.pass.cpp
libcxx/trunk/test/containers/associative/multiset/count.pass.cpp
libcxx/trunk/test/containers/associative/multiset/emplace.pass.cpp
libcxx/trunk/test/containers/associative/multiset/emplace_hint.pass.cpp
libcxx/trunk/test/containers/associative/multiset/empty.pass.cpp
libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp
libcxx/trunk/test/containers/associative/multiset/erase_iter.pass.cpp
libcxx/trunk/test/containers/associative/multiset/erase_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/multiset/erase_key.pass.cpp
libcxx/trunk/test/containers/associative/multiset/find.pass.cpp
libcxx/trunk/test/containers/associative/multiset/insert_cv.pass.cpp
libcxx/trunk/test/containers/associative/multiset/insert_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multiset/insert_iter_cv.pass.cpp
libcxx/trunk/test/containers/associative/multiset/insert_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/multiset/insert_iter_rv.pass.cpp
libcxx/trunk/test/containers/associative/multiset/insert_rv.pass.cpp
libcxx/trunk/test/containers/associative/multiset/iterator.pass.cpp
libcxx/trunk/test/containers/associative/multiset/lower_bound.pass.cpp
libcxx/trunk/test/containers/associative/multiset/max_size.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/default.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/move.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp
libcxx/trunk/test/containers/associative/multiset/size.pass.cpp
libcxx/trunk/test/containers/associative/multiset/types.pass.cpp
libcxx/trunk/test/containers/associative/multiset/upper_bound.pass.cpp
libcxx/trunk/test/containers/associative/set/clear.pass.cpp
libcxx/trunk/test/containers/associative/set/count.pass.cpp
libcxx/trunk/test/containers/associative/set/emplace.pass.cpp
libcxx/trunk/test/containers/associative/set/emplace_hint.pass.cpp
libcxx/trunk/test/containers/associative/set/empty.pass.cpp
libcxx/trunk/test/containers/associative/set/equal_range.pass.cpp
libcxx/trunk/test/containers/associative/set/erase_iter.pass.cpp
libcxx/trunk/test/containers/associative/set/erase_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/set/erase_key.pass.cpp
libcxx/trunk/test/containers/associative/set/find.pass.cpp
libcxx/trunk/test/containers/associative/set/insert_cv.pass.cpp
libcxx/trunk/test/containers/associative/set/insert_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/set/insert_iter_cv.pass.cpp
libcxx/trunk/test/containers/associative/set/insert_iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/set/insert_iter_rv.pass.cpp
libcxx/trunk/test/containers/associative/set/insert_rv.pass.cpp
libcxx/trunk/test/containers/associative/set/iterator.pass.cpp
libcxx/trunk/test/containers/associative/set/lower_bound.pass.cpp
libcxx/trunk/test/containers/associative/set/max_size.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/default.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/iter_iter.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/move.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/move_assign.pass.cpp
libcxx/trunk/test/containers/associative/set/set.special/member_swap.pass.cpp
libcxx/trunk/test/containers/associative/set/size.pass.cpp
libcxx/trunk/test/containers/associative/set/types.pass.cpp
libcxx/trunk/test/containers/associative/set/upper_bound.pass.cpp
Modified: libcxx/trunk/include/__tree
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Wed Jun 19 16:29:40 2013
@@ -644,7 +644,8 @@ public:
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
- _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
+ _LIBCPP_INLINE_VISIBILITY pointer operator->() const
+ {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator++()
@@ -686,7 +687,7 @@ class _LIBCPP_TYPE_VIS __tree_const_iter
{
typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
- typedef const typename __node::base __node_base;
+ typedef typename __node::base __node_base;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node_base>
@@ -729,7 +730,8 @@ public:
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
- _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
+ _LIBCPP_INLINE_VISIBILITY pointer operator->() const
+ {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++()
@@ -779,8 +781,10 @@ public:
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
- typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
- typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
+ typedef typename __alloc_traits::void_pointer __void_pointer;
+
+ typedef __tree_node<value_type, __void_pointer> __node;
+ typedef __tree_node_base<__void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -790,9 +794,9 @@ public:
__node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
- typedef typename __node_traits::const_pointer __node_const_pointer;
+ typedef typename __node_traits::pointer __node_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
- typedef typename __node_base::const_pointer __node_base_const_pointer;
+ typedef typename __node_base::pointer __node_base_const_pointer;
private:
typedef typename __node_base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
@@ -804,9 +808,9 @@ private:
__end_node_ptr;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<const __end_node_t>
+ rebind<__end_node_t>
#else
- rebind<const __end_node_t>::other
+ rebind<__end_node_t>::other
#endif
__end_node_const_ptr;
@@ -828,7 +832,7 @@ public:
{
return static_cast<__node_const_pointer>
(
- pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
+ pointer_traits<__end_node_const_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))
);
}
_LIBCPP_INLINE_VISIBILITY
@@ -865,7 +869,7 @@ public:
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
- typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
+ typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
explicit __tree(const value_compare& __comp)
_NOEXCEPT_(
@@ -1102,6 +1106,9 @@ private:
__node_pointer __detach();
static __node_pointer __detach(__node_pointer);
+
+ template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
+ template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -1161,7 +1168,7 @@ __tree<_Tp, _Compare, _Allocator>::__det
{
if (__cache->__parent_ == nullptr)
return nullptr;
- if (__tree_is_left_child(__cache))
+ if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
{
__cache->__parent_->__left_ = nullptr;
__cache = static_cast<__node_pointer>(__cache->__parent_);
@@ -1294,7 +1301,7 @@ __tree<_Tp, _Compare, _Allocator>::__tre
__begin_node() = __end_node();
else
{
- __end_node()->__left_->__parent_ = __end_node();
+ __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
__t.size() = 0;
@@ -1314,7 +1321,7 @@ __tree<_Tp, _Compare, _Allocator>::__tre
{
__begin_node() = __t.__begin_node();
__end_node()->__left_ = __t.__end_node()->__left_;
- __end_node()->__left_->__parent_ = __end_node();
+ __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
size() = __t.size();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
@@ -1342,7 +1349,7 @@ __tree<_Tp, _Compare, _Allocator>::__mov
__begin_node() = __end_node();
else
{
- __end_node()->__left_->__parent_ = __end_node();
+ __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
__t.size() = 0;
@@ -1447,11 +1454,11 @@ __tree<_Tp, _Compare, _Allocator>::swap(
if (size() == 0)
__begin_node() = __end_node();
else
- __end_node()->__left_->__parent_ = __end_node();
+ __end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
if (__t.size() == 0)
__t.__begin_node() = __t.__end_node();
else
- __t.__end_node()->__left_->__parent_ = __t.__end_node();
+ __t.__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__t.__end_node());
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1483,7 +1490,7 @@ __tree<_Tp, _Compare, _Allocator>::__fin
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__right_;
}
}
@@ -1493,13 +1500,13 @@ __tree<_Tp, _Compare, _Allocator>::__fin
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__left_;
}
}
}
}
- __parent = __end_node();
+ __parent = static_cast<__node_base_pointer>(__end_node());
return __parent->__left_;
}
@@ -1522,7 +1529,7 @@ __tree<_Tp, _Compare, _Allocator>::__fin
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__left_;
}
}
@@ -1532,13 +1539,13 @@ __tree<_Tp, _Compare, _Allocator>::__fin
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__right_;
}
}
}
}
- __parent = __end_node();
+ __parent = static_cast<__node_base_pointer>(__end_node());
return __parent->__left_;
}
@@ -1563,12 +1570,12 @@ __tree<_Tp, _Compare, _Allocator>::__fin
// *prev(__hint) <= __v <= *__hint
if (__hint.__ptr_->__left_ == nullptr)
{
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
return __parent->__left_;
}
else
{
- __parent = const_cast<__node_pointer&>(__prior.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__prior.__ptr_);
return __parent->__right_;
}
}
@@ -1600,7 +1607,7 @@ __tree<_Tp, _Compare, _Allocator>::__fin
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__left_;
}
}
@@ -1610,18 +1617,18 @@ __tree<_Tp, _Compare, _Allocator>::__fin
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__right_;
}
}
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent;
}
}
}
- __parent = __end_node();
+ __parent = static_cast<__node_base_pointer>(__end_node());
return __parent->__left_;
}
@@ -1648,12 +1655,12 @@ __tree<_Tp, _Compare, _Allocator>::__fin
// *prev(__hint) < __v < *__hint
if (__hint.__ptr_->__left_ == nullptr)
{
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
return __parent->__left_;
}
else
{
- __parent = const_cast<__node_pointer&>(__prior.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__prior.__ptr_);
return __parent->__right_;
}
}
@@ -1669,12 +1676,12 @@ __tree<_Tp, _Compare, _Allocator>::__fin
// *__hint < __v < *_VSTD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
return __parent->__right_;
}
else
{
- __parent = const_cast<__node_pointer&>(__next.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__next.__ptr_);
return __parent->__left_;
}
}
@@ -1682,7 +1689,7 @@ __tree<_Tp, _Compare, _Allocator>::__fin
return __find_equal(__parent, __v);
}
// else __v == *__hint
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
+ __parent = static_cast<__node_base_pointer>(__hint.__ptr_);
return __parent;
}
@@ -1729,7 +1736,7 @@ __tree<_Tp, _Compare, _Allocator>::__emp
bool __inserted = false;
if (__child == nullptr)
{
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
__inserted = true;
}
@@ -1747,7 +1754,7 @@ __tree<_Tp, _Compare, _Allocator>::__emp
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
}
return iterator(__r);
@@ -1761,7 +1768,7 @@ __tree<_Tp, _Compare, _Allocator>::__emp
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(static_cast<__node_pointer>(__h.release()));
}
@@ -1774,7 +1781,7 @@ __tree<_Tp, _Compare, _Allocator>::__emp
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(static_cast<__node_pointer>(__h.release()));
}
@@ -1812,7 +1819,7 @@ __tree<_Tp, _Compare, _Allocator>::__ins
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(__h.release());
}
@@ -1824,7 +1831,7 @@ __tree<_Tp, _Compare, _Allocator>::__ins
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(__h.release());
}
@@ -1854,7 +1861,7 @@ __tree<_Tp, _Compare, _Allocator>::__ins
if (__child == nullptr)
{
__node_holder __h = __construct_node(__v);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
__inserted = true;
}
@@ -1871,7 +1878,7 @@ __tree<_Tp, _Compare, _Allocator>::__ins
if (__child == nullptr)
{
__node_holder __h = __construct_node(__v);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
}
return iterator(__r);
@@ -1884,7 +1891,7 @@ __tree<_Tp, _Compare, _Allocator>::__ins
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
__node_holder __h = __construct_node(__v);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(__h.release());
}
@@ -1895,7 +1902,7 @@ __tree<_Tp, _Compare, _Allocator>::__ins
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
__node_holder __h = __construct_node(__v);
- __insert_node_at(__parent, __child, __h.get());
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(__h.release());
}
@@ -1909,7 +1916,7 @@ __tree<_Tp, _Compare, _Allocator>::__nod
bool __inserted = false;
if (__child == nullptr)
{
- __insert_node_at(__parent, __child, __nd);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__r = __nd;
__inserted = true;
}
@@ -1926,7 +1933,7 @@ __tree<_Tp, _Compare, _Allocator>::__nod
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
- __insert_node_at(__parent, __child, __nd);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__r = __nd;
}
return iterator(__r);
@@ -1938,7 +1945,7 @@ __tree<_Tp, _Compare, _Allocator>::__nod
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
- __insert_node_at(__parent, __child, __nd);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
return iterator(__nd);
}
@@ -1949,7 +1956,7 @@ __tree<_Tp, _Compare, _Allocator>::__nod
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
- __insert_node_at(__parent, __child, __nd);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
return iterator(__nd);
}
@@ -1957,7 +1964,7 @@ template <class _Tp, class _Compare, cla
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
{
- __node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
+ __node_pointer __np = __p.__ptr_;
iterator __r(__np);
++__r;
if (__begin_node() == __np)
@@ -1977,7 +1984,7 @@ __tree<_Tp, _Compare, _Allocator>::erase
{
while (__f != __l)
__f = erase(__f);
- return iterator(const_cast<__node_pointer>(__l.__ptr_));
+ return iterator(__l.__ptr_);
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2264,7 +2271,7 @@ template <class _Tp, class _Compare, cla
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
{
- __node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
+ __node_pointer __np = __p.__ptr_;
if (__begin_node() == __np)
{
if (__np->__right_ != nullptr)
Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Wed Jun 19 16:29:40 2013
@@ -489,8 +489,8 @@ class __map_node_destructor
public:
typedef typename __alloc_traits::pointer pointer;
private:
- typedef typename value_type::first_type first_type;
- typedef typename value_type::second_type second_type;
+ typedef typename value_type::value_type::first_type first_type;
+ typedef typename value_type::value_type::second_type second_type;
allocator_type& __na_;
@@ -522,9 +522,9 @@ public:
void operator()(pointer __p) _NOEXCEPT
{
if (__second_constructed)
- __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
+ __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.second));
if (__first_constructed)
- __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
+ __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -542,8 +542,8 @@ class _LIBCPP_TYPE_VIS __map_iterator
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
- typedef const typename _TreeIterator::value_type::first_type __key_type;
- typedef typename _TreeIterator::value_type::second_type __mapped_type;
+ typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
+ typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<__key_type, __mapped_type> value_type;
@@ -564,9 +564,9 @@ public:
__map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return *operator->();}
+ reference operator*() const {return __i_->__cc;}
_LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return (pointer)__i_.operator->();}
+ pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
_LIBCPP_INLINE_VISIBILITY
__map_iterator& operator++() {++__i_; return *this;}
@@ -607,8 +607,8 @@ class _LIBCPP_TYPE_VIS __map_const_itera
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
- typedef const typename _TreeIterator::value_type::first_type __key_type;
- typedef typename _TreeIterator::value_type::second_type __mapped_type;
+ typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
+ typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<__key_type, __mapped_type> value_type;
@@ -634,9 +634,9 @@ public:
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
- reference operator*() const {return *operator->();}
+ reference operator*() const {return __i_->__cc;}
_LIBCPP_INLINE_VISIBILITY
- pointer operator->() const {return (pointer)__i_.operator->();}
+ pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator& operator++() {++__i_; return *this;}
@@ -679,6 +679,7 @@ public:
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;
typedef _Compare key_compare;
typedef _Allocator allocator_type;
typedef value_type& reference;
@@ -699,7 +700,54 @@ public:
};
private:
- typedef pair<key_type, mapped_type> __value_type;
+
+#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(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();}
+
+ operator const value_type& () const {return __cc;}
+ };
+#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) {}
+
+ operator const value_type& () const {return __cc;}
+ };
+#endif
typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -764,7 +812,14 @@ public:
_LIBCPP_INLINE_VISIBILITY
map& operator=(const map& __m)
{
+#if __cplusplus >= 201103L
__tree_ = __m.__tree_;
+#else
+ __tree_.clear();
+ __tree_.value_comp() = __m.__tree_.value_comp();
+ __tree_.__copy_assign_alloc(__m.__tree_);
+ insert(__m.begin(), __m.end());
+#endif
return *this;
}
@@ -1009,9 +1064,6 @@ private:
__node_base_pointer&
__find_equal_key(__node_base_pointer& __parent, const key_type& __k);
- __node_base_pointer&
- __find_equal_key(const_iterator __hint,
- __node_base_pointer& __parent, const key_type& __k);
__node_base_const_pointer
__find_equal_key(__node_base_const_pointer& __parent, const key_type& __k) const;
};
@@ -1030,97 +1082,37 @@ map<_Key, _Tp, _Compare, _Allocator>::__
{
while (true)
{
- if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
+ if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
{
if (__nd->__left_ != nullptr)
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__left_;
}
}
- else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
+ else if (__tree_.value_comp().key_comp()(__nd->__value_.__cc.first, __k))
{
if (__nd->__right_ != nullptr)
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent->__right_;
}
}
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent;
}
}
}
- __parent = __tree_.__end_node();
+ __parent = static_cast<__node_base_pointer>(__tree_.__end_node());
return __parent->__left_;
}
-// Find place to insert if __k doesn't exist
-// First check prior to __hint.
-// Next check after __hint.
-// Next do O(log N) search.
-// Set __parent to parent of null leaf
-// Return reference to null leaf
-// If __k exists, set parent to node of __k and return reference to node of __k
-template <class _Key, class _Tp, class _Compare, class _Allocator>
-typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
-map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
- __node_base_pointer& __parent,
- const key_type& __k)
-{
- if (__hint == end() || __tree_.value_comp().key_comp()(__k, __hint->first)) // check before
- {
- // __k < *__hint
- const_iterator __prior = __hint;
- if (__prior == begin() || __tree_.value_comp().key_comp()((--__prior)->first, __k))
- {
- // *prev(__hint) < __k < *__hint
- if (__hint.__ptr_->__left_ == nullptr)
- {
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
- return __parent->__left_;
- }
- else
- {
- __parent = const_cast<__node_pointer&>(__prior.__ptr_);
- return __parent->__right_;
- }
- }
- // __k <= *prev(__hint)
- return __find_equal_key(__parent, __k);
- }
- else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
- {
- // *__hint < __k
- const_iterator __next = _VSTD::next(__hint);
- if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
- {
- // *__hint < __k < *next(__hint)
- if (__hint.__ptr_->__right_ == nullptr)
- {
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
- return __parent->__right_;
- }
- else
- {
- __parent = const_cast<__node_pointer&>(__next.__ptr_);
- return __parent->__left_;
- }
- }
- // *next(__hint) <= __k
- return __find_equal_key(__parent, __k);
- }
- // else __k == *__hint
- __parent = const_cast<__node_pointer&>(__hint.__ptr_);
- return __parent;
-}
-
// Find __k
// Set __parent to parent of null leaf and
// return reference to null leaf iv __k does not exist.
@@ -1135,34 +1127,34 @@ map<_Key, _Tp, _Compare, _Allocator>::__
{
while (true)
{
- if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
+ if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
{
if (__nd->__left_ != nullptr)
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return const_cast<const __node_base_const_pointer&>(__parent->__left_);
}
}
- else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
+ else if (__tree_.value_comp().key_comp()(__nd->__value_.__cc.first, __k))
{
if (__nd->__right_ != nullptr)
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return const_cast<const __node_base_const_pointer&>(__parent->__right_);
}
}
else
{
- __parent = __nd;
+ __parent = static_cast<__node_base_pointer>(__nd);
return __parent;
}
}
}
- __parent = __tree_.__end_node();
+ __parent = static_cast<__node_base_pointer>(__tree_.__end_node());
return const_cast<const __node_base_const_pointer&>(__parent->__left_);
}
@@ -1187,9 +1179,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first));
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1222,9 +1214,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1256,9 +1248,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h);
}
@@ -1275,10 +1267,10 @@ map<_Key, _Tp, _Compare, _Allocator>::op
if (__child == nullptr)
{
__node_holder __h = __construct_node(__k);
- __tree_.__insert_node_at(__parent, __child, __h.get());
+ __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
}
- return __r->__value_.second;
+ return __r->__value_.__cc.second;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1293,10 +1285,10 @@ map<_Key, _Tp, _Compare, _Allocator>::op
if (__child == nullptr)
{
__node_holder __h = __construct_node(_VSTD::move(__k));
- __tree_.__insert_node_at(__parent, __child, __h.get());
+ __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
}
- return __r->__value_.second;
+ return __r->__value_.__cc.second;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1311,7 +1303,7 @@ map<_Key, _Tp, _Compare, _Allocator>::at
if (__child == nullptr)
throw out_of_range("map::at: key not found");
#endif // _LIBCPP_NO_EXCEPTIONS
- return static_cast<__node_pointer>(__child)->__value_.second;
+ return static_cast<__node_pointer>(__child)->__value_.__cc.second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@@ -1324,7 +1316,7 @@ map<_Key, _Tp, _Compare, _Allocator>::at
if (__child == nullptr)
throw out_of_range("map::at: key not found");
#endif // _LIBCPP_NO_EXCEPTIONS
- return static_cast<__node_const_pointer>(__child)->__value_.second;
+ return static_cast<__node_const_pointer>(__child)->__value_.__cc.second;
}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -1429,6 +1421,7 @@ public:
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;
typedef _Compare key_compare;
typedef _Allocator allocator_type;
typedef value_type& reference;
@@ -1450,7 +1443,53 @@ public:
};
private:
- typedef pair<key_type, mapped_type> __value_type;
+#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();}
+
+ operator const value_type& () const {return __cc;}
+ };
+#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) {}
+
+ operator const value_type& () const {return __cc;}
+ };
+#endif
typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -1516,7 +1555,14 @@ public:
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(const multimap& __m)
{
+#if __cplusplus >= 201103L
__tree_ = __m.__tree_;
+#else
+ __tree_.clear();
+ __tree_.value_comp() = __m.__tree_.value_comp();
+ __tree_.__copy_assign_alloc(__m.__tree_);
+ insert(__m.begin(), __m.end());
+#endif
return *this;
}
@@ -1766,9 +1812,9 @@ multimap<_Key, _Tp, _Compare, _Allocator
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first));
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1801,9 +1847,9 @@ multimap<_Key, _Tp, _Compare, _Allocator
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/at.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/at.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/at.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/at.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,6 +17,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -83,4 +85,70 @@ int main()
assert(m.at(8) == 8.5);
assert(m.size() == 7);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ m.at(1) = -1.5;
+ assert(m.at(1) == -1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
+ try
+ {
+ m.at(6);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
+ try
+ {
+ m.at(6);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/empty.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/empty.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/empty.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::map<int, double> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/index_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/index_key.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/index_key.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/index_key.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -41,4 +44,33 @@ int main()
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 8);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m[1] == 1.5);
+ assert(m.size() == 7);
+ const int i = 1;
+ m[i] = -1.5;
+ assert(m[1] == -1.5);
+ assert(m.size() == 7);
+ assert(m[6] == 0);
+ assert(m.size() == 8);
+ m[6] = 6.5;
+ assert(m[6] == 6.5);
+ assert(m.size() == 8);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/index_rv_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/index_rv_key.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/index_rv_key.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/index_rv_key.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
typedef std::pair<MoveOnly, double> V;
std::map<MoveOnly, double> m;
assert(m.size() == 0);
@@ -34,5 +36,23 @@ int main()
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 2);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, double> V;
+ std::map<MoveOnly, double, std::less<MoveOnly>, min_allocator<V>> m;
+ assert(m.size() == 0);
+ assert(m[1] == 0.0);
+ assert(m.size() == 1);
+ m[1] = -1.5;
+ assert(m[1] == -1.5);
+ assert(m.size() == 1);
+ assert(m[6] == 0);
+ assert(m.size() == 2);
+ m[6] = 6.5;
+ assert(m[6] == 6.5);
+ assert(m.size() == 2);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/iterator.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/iterator.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/iterator.pass.cpp Wed Jun 19 16:29:40 2013
@@ -29,6 +29,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -117,4 +119,92 @@ int main()
assert(i->second == 1);
}
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
+ i = m.begin();
+ std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == 1);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == 1);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/max_size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/max_size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/max_size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::map<int, double> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.access/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.access/size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.access/size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.access/size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::map<int, double> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,13 +17,26 @@
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::less<int> C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::map<int, double, C, A> m(A{});
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.get_allocator() == A());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -41,5 +44,32 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ std::map<int, double, std::less<int>, min_allocator<V>> m =
+ {
+ {20, 1},
+ };
+ m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/compare.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/compare.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/compare.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,12 +17,24 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
std::map<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(3));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/compare_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/compare_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A(5));
@@ -28,4 +30,16 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::map<int, double, C, A> m(C(4), A());
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(4));
+ assert(m.get_allocator() == A());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/copy.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/copy.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/copy.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -91,4 +92,40 @@ int main()
assert(*next(mo.begin(), 2) == V(3, 1));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/copy_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/copy_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/copy_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -53,4 +55,41 @@ int main()
assert(*mo.begin() == V(1, 1));
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(mo, A());
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/copy_assign.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/copy_assign.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -91,4 +92,76 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2)
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+ m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2)
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+ m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/default.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/default.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::map<int, double> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/default_recursive.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/default_recursive.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/default_recursive.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/default_recursive.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,7 +19,7 @@
struct X
{
- std::multimap<int, X> m;
+ std::map<int, X> m;
};
#endif
Modified: libcxx/trunk/test/containers/associative/map/map.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -37,5 +40,28 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ std::map<int, double, std::less<int>, min_allocator<V>> m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,10 +16,12 @@
#include <map>
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
std::map<int, double, C> m({
@@ -39,5 +41,29 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef test_compare<std::less<int> > C;
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m({
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ }, C(3));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ assert(m.key_comp() == C(3));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -42,5 +44,31 @@ int main()
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A(6));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::map<int, double, C, A> m({
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ }, C(3), A());
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ assert(m.key_comp() == C(3));
+ assert(m.get_allocator() == A());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -38,4 +41,28 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -42,4 +44,30 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -20,9 +20,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -46,4 +48,32 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/move.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/move.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -68,5 +69,52 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(C(5), A());
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(distance(m.begin(), m.end()) == 0);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/move_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/move_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/move_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -140,5 +141,46 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/move_assign.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/move_assign.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -143,5 +144,47 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/clear.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/clear.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/clear.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/emplace.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/emplace.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/emplace.pass.cpp Wed Jun 19 16:29:40 2013
@@ -20,6 +20,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -88,5 +89,71 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace();
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(1);
+ assert(r.second);
+ assert(r.first == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(1);
+ assert(!r.second);
+ assert(r.first == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(2);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(!r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -82,5 +83,66 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace_hint(m.end());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.end(), 1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.end(), 1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), 2);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -124,4 +126,112 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 5);
+ assert(next(m.begin(), 3)->second == 5.5);
+ assert(next(m.begin(), 4)->first == 6);
+ assert(next(m.begin(), 4)->second == 6.5);
+ assert(next(m.begin(), 5)->first == 7);
+ assert(next(m.begin(), 5)->second == 7.5);
+ assert(next(m.begin(), 6)->first == 8);
+ assert(next(m.begin(), 6)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == next(m.begin()));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 6);
+ assert(next(m.begin(), 2)->second == 6.5);
+ assert(next(m.begin(), 3)->first == 7);
+ assert(next(m.begin(), 3)->second == 7.5);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 7);
+ assert(next(m.begin(), 2)->second == 7.5);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == next(m.begin(), 0));
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -84,4 +86,72 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 4);
+ assert(next(m.begin(), 3)->second == 4.5);
+ assert(next(m.begin(), 4)->first == 5);
+ assert(next(m.begin(), 4)->second == 5.5);
+ assert(next(m.begin(), 5)->first == 6);
+ assert(next(m.begin(), 5)->second == 6.5);
+ assert(next(m.begin(), 6)->first == 7);
+ assert(next(m.begin(), 6)->second == 7.5);
+ assert(next(m.begin(), 7)->first == 8);
+ assert(next(m.begin(), 7)->second == 8.5);
+
+ i = m.erase(m.cbegin(), next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/erase_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/erase_key.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/erase_key.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/erase_key.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -143,4 +145,131 @@ int main()
assert(m.size() == 0);
assert(s == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type R;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ R s = m.erase(9);
+ assert(s == 0);
+ assert(m.size() == 8);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 4);
+ assert(next(m.begin(), 3)->second == 4.5);
+ assert(next(m.begin(), 4)->first == 5);
+ assert(next(m.begin(), 4)->second == 5.5);
+ assert(next(m.begin(), 5)->first == 6);
+ assert(next(m.begin(), 5)->second == 6.5);
+ assert(next(m.begin(), 6)->first == 7);
+ assert(next(m.begin(), 6)->second == 7.5);
+ assert(next(m.begin(), 7)->first == 8);
+ assert(next(m.begin(), 7)->second == 8.5);
+
+ s = m.erase(4);
+ assert(m.size() == 7);
+ assert(s == 1);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 5);
+ assert(next(m.begin(), 3)->second == 5.5);
+ assert(next(m.begin(), 4)->first == 6);
+ assert(next(m.begin(), 4)->second == 6.5);
+ assert(next(m.begin(), 5)->first == 7);
+ assert(next(m.begin(), 5)->second == 7.5);
+ assert(next(m.begin(), 6)->first == 8);
+ assert(next(m.begin(), 6)->second == 8.5);
+
+ s = m.erase(1);
+ assert(m.size() == 6);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ s = m.erase(8);
+ assert(m.size() == 5);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+
+ s = m.erase(3);
+ assert(m.size() == 4);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 6);
+ assert(next(m.begin(), 2)->second == 6.5);
+ assert(next(m.begin(), 3)->first == 7);
+ assert(next(m.begin(), 3)->second == 7.5);
+
+ s = m.erase(6);
+ assert(m.size() == 3);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 7);
+ assert(next(m.begin(), 2)->second == 7.5);
+
+ s = m.erase(7);
+ assert(m.size() == 2);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+
+ s = m.erase(2);
+ assert(m.size() == 1);
+ assert(s == 1);
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
+
+ s = m.erase(5);
+ assert(m.size() == 0);
+ assert(s == 1);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -50,4 +52,38 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2, 2.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2.5);
+
+ r = m.insert(M::value_type(1, 1.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -39,5 +42,30 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ std::map<int, double, std::less<int>, min_allocator<V>> m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ m.insert({
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ });
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(r->first == 3);
assert(r->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), M::value_type(2, 2.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
+
+ r = m.insert(m.end(), M::value_type(1, 1.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
+
+ r = m.insert(m.end(), M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+
+ r = m.insert(m.end(), M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -46,4 +47,31 @@ int main()
assert(next(m.begin(), 2)->first == 3);
assert(next(m.begin(), 2)->second == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 1);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 1);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -51,5 +52,36 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.end(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -54,5 +55,39 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2, 2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2);
+
+ r = m.insert(M::value_type(1, 1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/map/map.ops/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.ops/count.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.ops/count.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.ops/count.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -53,4 +56,44 @@ int main()
r = m.count(4);
assert(r == 0);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::size_type R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.ops/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.ops/equal_range.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.ops/equal_range.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.ops/equal_range.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -153,4 +156,143 @@ int main()
assert(r.first == next(m.begin(), 8));
assert(r.second == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.ops/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.ops/find.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.ops/find.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.ops/find.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -87,4 +90,77 @@ int main()
r = m.find(4);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.ops/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.ops/lower_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.ops/lower_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.ops/lower_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.ops/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.ops/upper_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.ops/upper_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.ops/upper_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.special/member_swap.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.special/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.special/member_swap.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -104,4 +107,95 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/map.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.special/non_member_swap.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.special/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.special/non_member_swap.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,9 +19,11 @@
#include <cassert>
#include "../../../test_allocator.h"
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -176,4 +178,129 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ typedef min_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ typedef std::map<int, double, C, A> M;
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A());
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A());
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/map/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/types.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/types.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/types.pass.cpp Wed Jun 19 16:29:40 2013
@@ -32,8 +32,11 @@
#include <map>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::map<int, double>::key_type, int>::value), "");
static_assert((std::is_same<std::map<int, double>::mapped_type, double>::value), "");
static_assert((std::is_same<std::map<int, double>::value_type, std::pair<const int, double> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::map<int, double>::const_pointer, const std::pair<const int, double>*>::value), "");
static_assert((std::is_same<std::map<int, double>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::map<int, double>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::mapped_type, double>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::value_type, std::pair<const int, double> >::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::reference, std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_reference, const std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/empty.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/empty.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/empty.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/iterator.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/iterator.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/iterator.pass.cpp Wed Jun 19 16:29:40 2013
@@ -29,6 +29,8 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -119,4 +121,94 @@ int main()
assert(i->second == d);
}
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
+ i = m.begin();
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == d);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == d);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/max_size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/max_size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/max_size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,13 +17,26 @@
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::less<int> C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::multimap<int, double, C, A> m(A{});
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.get_allocator() == A());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m = {{20, 1}};
@@ -46,5 +49,37 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m = {{20, 1}};
+ m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,12 +17,24 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
std::multimap<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(3));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(C(4), A(5));
@@ -28,4 +30,16 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::multimap<int, double, C, A> m(C(4), A());
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(4));
+ assert(m.get_allocator() == A());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -73,4 +74,31 @@ int main()
assert(mo.key_comp() == C(5));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -44,4 +46,32 @@ int main()
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m(mo, A());
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -73,4 +74,32 @@ int main()
assert(mo.get_allocator() == A(2));
assert(mo.key_comp() == C(5));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+ m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/default.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/default.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::multimap<int, double> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m =
@@ -45,5 +48,36 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,10 +16,12 @@
#include <map>
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef test_compare<std::less<int> > Cmp;
typedef std::multimap<int, double, Cmp> C;
typedef C::value_type V;
@@ -50,5 +52,40 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > Cmp;
+ typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m(
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ },
+ Cmp(4)
+ );
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ assert(m.key_comp() == Cmp(4));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<std::pair<const int, double> > A;
typedef std::multimap<int, double, Cmp, A> C;
@@ -53,5 +55,42 @@ int main()
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A(5));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > Cmp;
+ typedef min_allocator<std::pair<const int, double> > A;
+ typedef std::multimap<int, double, Cmp, A> C;
+ typedef C::value_type V;
+ C m(
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ },
+ Cmp(4), A()
+ );
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ assert(m.key_comp() == Cmp(4));
+ assert(m.get_allocator() == A());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -44,4 +47,34 @@ int main()
assert(*next(m.begin(), 6) == V(3, 1));
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,9 +19,11 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -49,4 +51,36 @@ int main()
assert(*next(m.begin(), 6) == V(3, 1));
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ std::multimap<int, double, C, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -20,9 +20,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -52,4 +54,38 @@ int main()
assert(*next(m.begin(), 6) == V(3, 1));
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/move.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/move.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -74,5 +75,58 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(C(5), A());
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(distance(m.begin(), m.end()) == 0);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -140,5 +141,46 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -143,5 +144,47 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -80,5 +81,64 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(1);
+ assert(r == next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(2);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(3, 3.5));
+ assert(r == next(m.begin()));
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -82,5 +83,66 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.cend(), 1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.cend(), 1);
+ assert(r == next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), 2);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(3, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -145,4 +147,133 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 8);
+ assert(i == next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 1.5);
+ assert(next(m.begin(), 4)->first == 2);
+ assert(next(m.begin(), 4)->second == 2);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 1);
+ assert(next(m.begin(), 6)->first == 3);
+ assert(next(m.begin(), 6)->second == 1.5);
+ assert(next(m.begin(), 7)->first == 3);
+ assert(next(m.begin(), 7)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 7);
+ assert(i == m.begin());
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 2);
+ assert(next(m.begin(), 2)->first == 2);
+ assert(next(m.begin(), 2)->second == 1.5);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 2);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 1.5);
+ assert(next(m.begin(), 6)->first == 3);
+ assert(next(m.begin(), 6)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 6);
+ assert(i == prev(m.end()));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 2);
+ assert(next(m.begin(), 2)->first == 2);
+ assert(next(m.begin(), 2)->second == 1.5);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 2);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 5);
+ assert(i == next(m.begin()));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 2);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 2);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 4);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 2);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 1);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 2);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 0));
+ assert(next(m.begin(), 0)->first == 2);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 3);
+ assert(next(m.begin(), 1)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 1);
+ assert(i == m.end());
+ assert(next(m.begin(), 0)->first == 2);
+ assert(next(m.begin(), 0)->second == 1.5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -84,4 +86,72 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 4);
+ assert(next(m.begin(), 3)->second == 4.5);
+ assert(next(m.begin(), 4)->first == 5);
+ assert(next(m.begin(), 4)->second == 5.5);
+ assert(next(m.begin(), 5)->first == 6);
+ assert(next(m.begin(), 5)->second == 6.5);
+ assert(next(m.begin(), 6)->first == 7);
+ assert(next(m.begin(), 6)->second == 7.5);
+ assert(next(m.begin(), 7)->first == 8);
+ assert(next(m.begin(), 7)->second == 8.5);
+
+ i = m.erase(m.cbegin(), next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -81,4 +83,69 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type I;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1.5);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 2);
+
+ i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 0);
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1.5);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 2);
+
+ i = m.erase(3);
+ assert(m.size() == 3);
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+
+ i = m.erase(1);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(r->first == 3);
assert(r->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2, 2.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
+
+ r = m.insert(M::value_type(1, 1.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m =
@@ -49,5 +52,40 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m =
+ {
+ {1, 1},
+ {1, 2},
+ {2, 1},
+ {2, 2},
+ {3, 1},
+ {3, 2}
+ };
+ m.insert(
+ {
+ {1, 1.5},
+ {2, 1.5},
+ {3, 1.5},
+ }
+ );
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 2));
+ assert(*++i == V(3, 1.5));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(r->first == 3);
assert(r->second == 4.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), M::value_type(2, 2.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
+
+ r = m.insert(m.end(), M::value_type(1, 1.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
+
+ r = m.insert(m.end(), M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+
+ r = m.insert(prev(m.end()), M::value_type(3, 4.5));
+ assert(r == prev(m.end(), 2));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 4.5);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,4 +59,43 @@ int main()
assert(next(m.begin(), 8)->first == 3);
assert(next(m.begin(), 8)->second == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 2);
+ assert(next(m.begin(), 4)->second == 1.5);
+ assert(next(m.begin(), 5)->first == 2);
+ assert(next(m.begin(), 5)->second == 2);
+ assert(next(m.begin(), 6)->first == 3);
+ assert(next(m.begin(), 6)->second == 1);
+ assert(next(m.begin(), 7)->first == 3);
+ assert(next(m.begin(), 7)->second == 1.5);
+ assert(next(m.begin(), 8)->first == 3);
+ assert(next(m.begin(), 8)->second == 2);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -51,5 +52,36 @@ int main()
assert(r->first == 3);
assert(r->second == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.cend(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.cend(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.cend(), P(3, 2));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -50,5 +51,35 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(M::value_type(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.ops/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.ops/count.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.ops/count.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.ops/count.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::size_type R;
@@ -50,4 +53,40 @@ int main()
r = m.count(10);
assert(r == 0);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::size_type R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 3);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 3);
+ r = m.count(10);
+ assert(r == 0);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef std::pair<M::iterator, M::iterator> R;
@@ -95,4 +98,84 @@ int main()
assert(r.first == m.end());
assert(r.second == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.ops/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.ops/find.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.ops/find.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.ops/find.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::iterator R;
@@ -77,4 +80,66 @@ int main()
r = m.find(10);
assert(r == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::iterator R;
@@ -81,4 +84,70 @@ int main()
r = m.lower_bound(10);
assert(r == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::iterator R;
@@ -81,4 +84,70 @@ int main()
r = m.upper_bound(10);
assert(r == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
V ar1[] =
@@ -104,4 +107,94 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,10 +19,12 @@
#include <cassert>
#include "../../../test_allocator.h"
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
V ar1[] =
@@ -176,4 +178,128 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ typedef min_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ typedef std::multimap<int, double, C, A> M;
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A());
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A());
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/types.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/types.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/types.pass.cpp Wed Jun 19 16:29:40 2013
@@ -32,8 +32,11 @@
#include <map>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::multimap<int, double>::key_type, int>::value), "");
static_assert((std::is_same<std::multimap<int, double>::mapped_type, double>::value), "");
static_assert((std::is_same<std::multimap<int, double>::value_type, std::pair<const int, double> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::multimap<int, double>::const_pointer, const std::pair<const int, double>*>::value), "");
static_assert((std::is_same<std::multimap<int, double>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::multimap<int, double>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::mapped_type, double>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::value_type, std::pair<const int, double> >::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::reference, std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_reference, const std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/clear.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/clear.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/clear.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/count.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/count.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/count.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -50,4 +53,41 @@ int main()
r = m.count(10);
assert(r == 0);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::size_type R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 4);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 2);
+ r = m.count(10);
+ assert(r == 0);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/emplace.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/emplace.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/emplace.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -67,5 +68,16 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multiset/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/emplace_hint.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/emplace_hint.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/emplace_hint.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -67,5 +68,16 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/multiset/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/empty.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/empty.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/empty.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multiset<int> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -95,4 +98,85 @@ int main()
assert(r.first == next(m.begin(), 9));
assert(r.second == next(m.begin(), 9));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 9));
+ assert(r.second == next(m.begin(), 9));
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 9));
+ assert(r.second == next(m.begin(), 9));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/erase_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/erase_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -96,4 +98,84 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 8);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == next(m.begin()));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 6);
+ assert(*next(m.begin(), 3) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/erase_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/erase_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -76,4 +78,64 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 5), next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == next(m.begin(), 5));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 4);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 6);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 8);
+
+ i = m.erase(next(m.cbegin(), 3), next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 7);
+ assert(*next(m.begin(), 3) == 8);
+
+ i = m.erase(next(m.cbegin(), 0), next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 7);
+ assert(*next(m.begin(), 1) == 8);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/erase_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/erase_key.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/erase_key.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/erase_key.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -70,4 +72,58 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] =
+ {
+ 3,
+ 3,
+ 3,
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(6);
+ assert(m.size() == 9);
+ assert(i == 0);
+ assert(*next(m.begin(), 0) == 3);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 5);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 7);
+ assert(*next(m.begin(), 8) == 7);
+
+ i = m.erase(5);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(*next(m.begin(), 0) == 3);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 7);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 7);
+
+ i = m.erase(3);
+ assert(m.size() == 3);
+ assert(i == 3);
+ assert(*next(m.begin(), 0) == 7);
+ assert(*next(m.begin(), 1) == 7);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(7);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/find.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/find.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/find.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,74 +17,150 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
- typedef int V;
- typedef std::multiset<int> M;
{
- typedef M::iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
{
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == next(m.begin()));
- r = m.find(7);
- assert(r == next(m.begin(), 2));
- r = m.find(8);
- assert(r == next(m.begin(), 3));
- r = m.find(9);
- assert(r == next(m.begin(), 4));
- r = m.find(10);
- assert(r == next(m.begin(), 5));
- r = m.find(11);
- assert(r == next(m.begin(), 6));
- r = m.find(12);
- assert(r == next(m.begin(), 7));
- r = m.find(4);
- assert(r == next(m.begin(), 8));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
}
+#if __cplusplus >= 201103L
{
- typedef M::const_iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
{
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == next(m.begin()));
- r = m.find(7);
- assert(r == next(m.begin(), 2));
- r = m.find(8);
- assert(r == next(m.begin(), 3));
- r = m.find(9);
- assert(r == next(m.begin(), 4));
- r = m.find(10);
- assert(r == next(m.begin(), 5));
- r = m.find(11);
- assert(r == next(m.begin(), 6));
- r = m.find(12);
- assert(r == next(m.begin(), 7));
- r = m.find(4);
- assert(r == next(m.begin(), 8));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
}
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/insert_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/insert_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/insert_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,30 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/insert_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/insert_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/insert_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -34,5 +37,25 @@ int main()
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m.insert({1, 2, 3, 4, 5, 6});
+ assert(m.size() == 8);
+ assert(distance(m.begin(), m.end()) == m.size());
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(*++i == V(8));
+ assert(*++i == V(10));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/insert_iter_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/insert_iter_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/insert_iter_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,30 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/insert_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/insert_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/insert_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -50,4 +51,35 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ M m;
+ m.insert(input_iterator<const V*>(ar),
+ input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 1);
+ assert(*next(m.begin(), 2) == 1);
+ assert(*next(m.begin(), 3) == 2);
+ assert(*next(m.begin(), 4) == 2);
+ assert(*next(m.begin(), 5) == 2);
+ assert(*next(m.begin(), 6) == 3);
+ assert(*next(m.begin(), 7) == 3);
+ assert(*next(m.begin(), 8) == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/insert_iter_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/insert_iter_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/insert_iter_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -46,4 +47,30 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/insert_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/insert_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/insert_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -46,4 +47,30 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/iterator.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/iterator.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/iterator.pass.cpp Wed Jun 19 16:29:40 2013
@@ -29,6 +29,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -105,10 +107,92 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
- std::multiset<int, double>::const_iterator i;
+ std::multiset<int>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (int k = 0; k < 3; ++k, ++i)
+ assert(*i == j);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
+ i = m.begin();
+ std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (int k = 0; k < 3; ++k, ++i)
+ assert(*i == j);
+ }
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
for (int j = 1; j <= 8; ++j)
for (int k = 0; k < 3; ++k, ++i)
assert(*i == j);
}
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/lower_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/lower_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/lower_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,68 +17,138 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
- typedef int V;
- typedef std::multiset<int> M;
{
- typedef M::iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
{
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == next(m.begin(), 9));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
}
+#if __cplusplus >= 201103L
{
- typedef M::const_iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
{
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == next(m.begin(), 9));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
}
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/max_size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/max_size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/max_size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multiset<int> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -32,5 +35,23 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/default.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/default.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::multiset<int> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::multiset<int, std::less<int>, min_allocator<int>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -31,5 +34,22 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -47,4 +49,35 @@ int main()
assert(*next(m.begin(), 6) == 3);
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ std::multiset<V, std::less<V>, min_allocator<V>> m(input_iterator<const int*>(ar),
+ input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 1);
+ assert(*next(m.begin(), 2) == 1);
+ assert(*next(m.begin(), 3) == 2);
+ assert(*next(m.begin(), 4) == 2);
+ assert(*next(m.begin(), 5) == 2);
+ assert(*next(m.begin(), 6) == 3);
+ assert(*next(m.begin(), 7) == 3);
+ assert(*next(m.begin(), 8) == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/move.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/move.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -76,4 +77,43 @@ int main()
assert(distance(mo.begin(), mo.end()) == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multiset<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 1);
+ assert(*next(m.begin(), 2) == 1);
+ assert(*next(m.begin(), 3) == 2);
+ assert(*next(m.begin(), 4) == 2);
+ assert(*next(m.begin(), 5) == 2);
+ assert(*next(m.begin(), 6) == 3);
+ assert(*next(m.begin(), 7) == 3);
+ assert(*next(m.begin(), 8) == 3);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -141,4 +142,45 @@ int main()
assert(m1.empty());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef MoveOnly V;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -104,4 +107,95 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multiset<int> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(2));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/types.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/types.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/types.pass.cpp Wed Jun 19 16:29:40 2013
@@ -32,8 +32,11 @@
#include <set>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::multiset<int>::key_type, int>::value), "");
static_assert((std::is_same<std::multiset<int>::value_type, int>::value), "");
static_assert((std::is_same<std::multiset<int>::key_compare, std::less<int> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::multiset<int>::const_pointer, const int*>::value), "");
static_assert((std::is_same<std::multiset<int>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::multiset<int>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::value_type, int>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::value_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::allocator_type, min_allocator<int>>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::reference, int&>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::const_reference, const int&>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/upper_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/upper_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/upper_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -81,4 +84,71 @@ int main()
r = m.upper_bound(11);
assert(r == next(m.begin(), 9));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/clear.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/clear.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/clear.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/count.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/count.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/count.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,11 +16,49 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
- typedef int V;
- typedef std::set<int> M;
{
+ typedef int V;
+ typedef std::set<int> M;
+ typedef M::size_type R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::size_type R;
V ar[] =
{
@@ -53,4 +91,5 @@ int main()
r = m.count(4);
assert(r == 0);
}
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/emplace.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/emplace.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/emplace.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -73,5 +74,17 @@ int main()
assert(m.size() == 1);
assert(*r.first == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/set/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/emplace_hint.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/emplace_hint.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/emplace_hint.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -67,5 +68,16 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/set/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/empty.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/empty.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/empty.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::set<int> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/equal_range.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/equal_range.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/equal_range.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -153,4 +156,75 @@ int main()
assert(r.first == next(m.begin(), 8));
assert(r.second == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/erase_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/erase_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -96,4 +98,84 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 8);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == next(m.begin()));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 6);
+ assert(*next(m.begin(), 3) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/erase_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/erase_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -76,4 +78,64 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 5), next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == next(m.begin(), 5));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 4);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 6);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 8);
+
+ i = m.erase(next(m.cbegin(), 3), next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 7);
+ assert(*next(m.begin(), 3) == 8);
+
+ i = m.erase(next(m.cbegin(), 0), next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 7);
+ assert(*next(m.begin(), 1) == 8);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/erase_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/erase_key.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/erase_key.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/erase_key.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -107,4 +109,95 @@ int main()
assert(m.size() == 0);
assert(i == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(9);
+ assert(m.size() == 8);
+ assert(i == 0);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 4);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 6);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 8);
+
+ i = m.erase(4);
+ assert(m.size() == 7);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(1);
+ assert(m.size() == 6);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 8);
+
+ i = m.erase(8);
+ assert(m.size() == 5);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+
+ i = m.erase(3);
+ assert(m.size() == 4);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 6);
+ assert(*next(m.begin(), 3) == 7);
+
+ i = m.erase(6);
+ assert(m.size() == 3);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(7);
+ assert(m.size() == 2);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+
+ i = m.erase(2);
+ assert(m.size() == 1);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 5);
+
+ i = m.erase(5);
+ assert(m.size() == 0);
+ assert(i == 1);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/find.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/find.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/find.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -87,4 +90,77 @@ int main()
r = m.find(4);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/insert_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/insert_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/insert_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/insert_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/insert_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/insert_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -34,5 +37,25 @@ int main()
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m.insert({1, 2, 3, 4, 5, 6});
+ assert(m.size() == 8);
+ assert(distance(m.begin(), m.end()) == m.size());
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(*++i == V(8));
+ assert(*++i == V(10));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/set/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/insert_iter_cv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/insert_iter_cv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/insert_iter_cv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,30 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/insert_iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/insert_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/insert_iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -44,4 +45,29 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ M m;
+ m.insert(input_iterator<const V*>(ar),
+ input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(*m.begin() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/insert_iter_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/insert_iter_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/insert_iter_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -45,5 +46,31 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/set/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/insert_rv.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/insert_rv.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/insert_rv.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -49,5 +50,35 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/set/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/iterator.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/iterator.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/iterator.pass.cpp Wed Jun 19 16:29:40 2013
@@ -29,6 +29,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -104,9 +106,89 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
- std::set<int, double>::const_iterator i;
+ std::set<int>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ assert(*i == j);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::set<int, std::less<int>, min_allocator<int>>::iterator i;
+ i = m.begin();
+ std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ assert(*i == j);
+ }
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
for (int j = 1; j <= m.size(); ++j, ++i)
assert(*i == j);
}
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/lower_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/lower_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/lower_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/max_size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/max_size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/max_size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::set<int> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -32,5 +35,23 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/default.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/default.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::set<int> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::set<int, std::less<int>, min_allocator<int>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/initializer_list.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/initializer_list.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -31,5 +34,22 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/iter_iter.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/iter_iter.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,9 +18,11 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -41,4 +43,29 @@ int main()
assert(*m.begin() == 1);
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ std::set<V, std::less<int>, min_allocator<int>> m(input_iterator<const int*>(ar),
+ input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/move.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/move.pass.cpp Wed Jun 19 16:29:40 2013
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -69,5 +70,38 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::set<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/move_assign.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/move_assign.pass.cpp Wed Jun 19 16:29:40 2013
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -140,5 +141,46 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef MoveOnly V;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/containers/associative/set/set.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.special/member_swap.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.special/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.special/member_swap.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -104,4 +107,95 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/size.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/size.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/size.pass.cpp Wed Jun 19 16:29:40 2013
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::set<int> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/types.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/types.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/types.pass.cpp Wed Jun 19 16:29:40 2013
@@ -32,8 +32,11 @@
#include <set>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::set<int>::key_type, int>::value), "");
static_assert((std::is_same<std::set<int>::value_type, int>::value), "");
static_assert((std::is_same<std::set<int>::key_compare, std::less<int> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::set<int>::const_pointer, const int*>::value), "");
static_assert((std::is_same<std::set<int>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::set<int>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::value_type, int>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::value_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::reference, int&>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::const_reference, const int&>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/upper_bound.pass.cpp?rev=184358&r1=184357&r2=184358&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/upper_bound.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/upper_bound.pass.cpp Wed Jun 19 16:29:40 2013
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
Added: libcxx/trunk/test/containers/min_allocator.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/min_allocator.h?rev=184358&view=auto
==============================================================================
--- libcxx/trunk/test/containers/min_allocator.h (added)
+++ libcxx/trunk/test/containers/min_allocator.h Wed Jun 19 16:29:40 2013
@@ -0,0 +1,268 @@
+#ifndef MIN_ALLOCATOR_H
+#define MIN_ALLOCATOR_H
+
+#if __cplusplus >= 201103L
+
+#include <memory>
+
+template <class T> class min_pointer;
+template <class T> class min_pointer<const T>;
+template <> class min_pointer<void>;
+template <> class min_pointer<const void>;
+template <class T> class min_allocator;
+
+template <class T>
+bool
+operator==(min_pointer<T> x, min_pointer<T> y);
+
+template <>
+class min_pointer<const void>
+{
+ const void* ptr_;
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ template <class T>
+ min_pointer(min_pointer<T> p) : ptr_(p.ptr_) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+};
+
+template <>
+class min_pointer<void>
+{
+ void* ptr_;
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ template <class T,
+ class = typename std::enable_if
+ <
+ !std::is_const<T>::value
+ >::type
+ >
+ min_pointer(min_pointer<T> p) : ptr_(p.ptr_) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+};
+
+template <class T>
+class min_pointer
+{
+ T* ptr_;
+
+ explicit min_pointer(T* p) : ptr_(p) {}
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ explicit min_pointer(min_pointer<void> p) : ptr_(static_cast<T*>(p.ptr_)) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ typedef std::ptrdiff_t difference_type;
+ typedef T& reference;
+ typedef T* pointer;
+ typedef T value_type;
+ typedef std::random_access_iterator_tag iterator_category;
+
+ reference operator*() const {return *ptr_;}
+ pointer operator->() const {return ptr_;}
+
+ min_pointer& operator++() {++ptr_; return *this;}
+ min_pointer operator++(int) {min_pointer tmp(*this); ++ptr_; return tmp;}
+
+ min_pointer& operator--() {--ptr_; return *this;}
+ min_pointer operator--(int) {min_pointer tmp(*this); --ptr_; return tmp;}
+
+ min_pointer& operator+=(difference_type n) {ptr_ += n; return *this;}
+ min_pointer& operator-=(difference_type n) {ptr_ -= n; return *this;}
+
+ min_pointer operator+(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp += n;
+ return tmp;
+ }
+
+ friend min_pointer operator+(difference_type n, min_pointer x)
+ {
+ return x + n;
+ }
+
+ min_pointer operator-(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp -= n;
+ return tmp;
+ }
+
+ friend difference_type operator-(min_pointer x, min_pointer y)
+ {
+ return x.ptr_ - y.ptr_;
+ }
+
+ reference operator[](difference_type n) const {return ptr_[n];}
+
+ friend bool operator< (min_pointer x, min_pointer y) {return x.ptr_ < y.ptr_;}
+ friend bool operator> (min_pointer x, min_pointer y) {return y < x;}
+ friend bool operator<=(min_pointer x, min_pointer y) {return !(y < x);}
+ friend bool operator>=(min_pointer x, min_pointer y) {return !(x < y);}
+
+ static min_pointer pointer_to(T& t) {return min_pointer(std::addressof(t));}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+ template <class U> friend class min_allocator;
+};
+
+template <class T>
+class min_pointer<const T>
+{
+ const T* ptr_;
+
+ explicit min_pointer(const T* p) : ptr_(p) {}
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ min_pointer(min_pointer<T> p) : ptr_(p.ptr_) {}
+ explicit min_pointer(min_pointer<const void> p) : ptr_(static_cast<const T*>(p.ptr_)) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ typedef std::ptrdiff_t difference_type;
+ typedef const T& reference;
+ typedef const T* pointer;
+ typedef const T value_type;
+ typedef std::random_access_iterator_tag iterator_category;
+
+ reference operator*() const {return *ptr_;}
+ pointer operator->() const {return ptr_;}
+
+ min_pointer& operator++() {++ptr_; return *this;}
+ min_pointer operator++(int) {min_pointer tmp(*this); ++ptr_; return tmp;}
+
+ min_pointer& operator--() {--ptr_; return *this;}
+ min_pointer operator--(int) {min_pointer tmp(*this); --ptr_; return tmp;}
+
+ min_pointer& operator+=(difference_type n) {ptr_ += n; return *this;}
+ min_pointer& operator-=(difference_type n) {ptr_ -= n; return *this;}
+
+ min_pointer operator+(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp += n;
+ return tmp;
+ }
+
+ friend min_pointer operator+(difference_type n, min_pointer x)
+ {
+ return x + n;
+ }
+
+ min_pointer operator-(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp -= n;
+ return tmp;
+ }
+
+ friend difference_type operator-(min_pointer x, min_pointer y)
+ {
+ return x.ptr_ - y.ptr_;
+ }
+
+ reference operator[](difference_type n) const {return ptr_[n];}
+
+ friend bool operator< (min_pointer x, min_pointer y) {return x.ptr_ < y.ptr_;}
+ friend bool operator> (min_pointer x, min_pointer y) {return y < x;}
+ friend bool operator<=(min_pointer x, min_pointer y) {return !(y < x);}
+ friend bool operator>=(min_pointer x, min_pointer y) {return !(x < y);}
+
+ static min_pointer pointer_to(const T& t) {return min_pointer(std::addressof(t));}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+};
+
+template <class T>
+inline
+bool
+operator==(min_pointer<T> x, min_pointer<T> y)
+{
+ return x.ptr_ == y.ptr_;
+}
+
+template <class T>
+inline
+bool
+operator!=(min_pointer<T> x, min_pointer<T> y)
+{
+ return !(x == y);
+}
+
+template <class T>
+inline
+bool
+operator==(min_pointer<T> x, std::nullptr_t)
+{
+ return !static_cast<bool>(x);
+}
+
+template <class T>
+inline
+bool
+operator==(std::nullptr_t, min_pointer<T> x)
+{
+ return !static_cast<bool>(x);
+}
+
+template <class T>
+inline
+bool
+operator!=(min_pointer<T> x, std::nullptr_t)
+{
+ return static_cast<bool>(x);
+}
+
+template <class T>
+inline
+bool
+operator!=(std::nullptr_t, min_pointer<T> x)
+{
+ return static_cast<bool>(x);
+}
+
+template <class T>
+class min_allocator
+{
+public:
+ typedef T value_type;
+ typedef min_pointer<T> pointer;
+
+ min_allocator() = default;
+ template <class U>
+ min_allocator(min_allocator<U>) {}
+
+ pointer allocate(std::ptrdiff_t n)
+ {
+ return pointer(static_cast<T*>(::operator new(n*sizeof(T))));
+ }
+
+ void deallocate(pointer p, std::ptrdiff_t)
+ {
+ return ::operator delete(p.ptr_);
+ }
+
+ friend bool operator==(min_allocator, min_allocator) {return true;}
+ friend bool operator!=(min_allocator x, min_allocator y) {return !(x == y);}
+};
+
+#endif // __cplusplus >= 201103L
+
+#endif // MIN_ALLOCATOR_H
More information about the cfe-commits
mailing list