[libcxx] r188320 - Second half (map/multimap) of N3657
Marshall Clow
mclow.lists at gmail.com
Tue Aug 13 15:18:47 PDT 2013
Author: marshall
Date: Tue Aug 13 17:18:47 2013
New Revision: 188320
URL: http://llvm.org/viewvc/llvm-project?rev=188320&view=rev
Log:
Second half (map/multimap) of N3657
Modified:
libcxx/trunk/include/map
libcxx/trunk/test/containers/associative/map/map.access/index_key.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/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/multiset/equal_range.pass.cpp
Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=188320&r1=188319&r2=188320&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Tue Aug 13 17:18:47 2013
@@ -149,13 +149,34 @@ public:
// map operations:
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
+ template<typename K>
+ iterator find(const K& x); // C++14
+ template<typename K>
+ const_iterator find(const K& x) const; // C++14
+ template<typename K>
+ size_type count(const K& x) const;
+
size_type count(const key_type& k) const;
iterator lower_bound(const key_type& k);
const_iterator lower_bound(const key_type& k) const;
+ template<typename K>
+ iterator lower_bound(const K& x); // C++14
+ template<typename K>
+ const_iterator lower_bound(const K& x) const; // C++14
+
iterator upper_bound(const key_type& k);
const_iterator upper_bound(const key_type& k) const;
+ template<typename K>
+ iterator upper_bound(const K& x); // C++14
+ template<typename K>
+ const_iterator upper_bound(const K& x) const; // C++14
+
pair<iterator,iterator> equal_range(const key_type& k);
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+ template<typename K>
+ pair<iterator,iterator> equal_range(const K& x); // C++14
+ template<typename K>
+ pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
};
template <class Key, class T, class Compare, class Allocator>
@@ -317,13 +338,34 @@ public:
// map operations:
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
+ template<typename K>
+ iterator find(const K& x); // C++14
+ template<typename K>
+ const_iterator find(const K& x) const; // C++14
+ template<typename K>
+ size_type count(const K& x) const;
+
size_type count(const key_type& k) const;
iterator lower_bound(const key_type& k);
const_iterator lower_bound(const key_type& k) const;
+ template<typename K>
+ iterator lower_bound(const K& x); // C++14
+ template<typename K>
+ const_iterator lower_bound(const K& x) const; // C++14
+
iterator upper_bound(const key_type& k);
const_iterator upper_bound(const key_type& k) const;
+ template<typename K>
+ iterator upper_bound(const K& x); // C++14
+ template<typename K>
+ const_iterator upper_bound(const K& x) const; // C++14
+
pair<iterator,iterator> equal_range(const key_type& k);
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+ template<typename K>
+ pair<iterator,iterator> equal_range(const K& x); // C++14
+ template<typename K>
+ pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
};
template <class Key, class T, class Compare, class Allocator>
@@ -409,6 +451,20 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.__cc.first);}
+
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+ operator () ( const _K2& __x, const _CP& __y ) const
+ {return static_cast<const _Compare&>(*this) (__x, __y.__cc.first);}
+
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+ operator () (const _CP& __x, const _K2& __y) const
+ {return static_cast<const _Compare&>(*this) (__x.__cc.first, __y);}
+#endif
};
template <class _Key, class _CP, class _Compare>
@@ -437,6 +493,20 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return comp(__x, __y.__cc.first);}
+
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+ operator () ( const _K2& __x, const _CP& __y ) const
+ {return comp (__x, __y.__cc.first);}
+
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
+ operator () (const _CP& __x, const _K2& __y) const
+ {return comp (__x.__cc.first, __y);}
+#endif
};
template <class _Allocator>
@@ -961,6 +1031,17 @@ public:
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ find(const _K2& __k) {return __tree_.find(__k);}
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ find(const _K2& __k) const {return __tree_.find(__k);}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
@@ -970,18 +1051,51 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
+
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+ equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+ equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
+#endif
private:
typedef typename __base::__node __node;
@@ -1666,6 +1780,17 @@ public:
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ find(const _K2& __k) {return __tree_.find(__k);}
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ find(const _K2& __k) const {return __tree_.find(__k);}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
@@ -1675,18 +1800,51 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
+
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
+ upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
+ upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
+ equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
+ equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+#endif
private:
typedef typename __base::__node __node;
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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -67,6 +68,34 @@ int main()
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
+#if _LIBCPP_STD_VER > 11
+ {
+ 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<>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+
+ assert(m.size() == 7);
+ assert(m[1] == 1.5);
+ assert(m.size() == 7);
+ m[1] = -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);
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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -295,4 +296,142 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(7) ] = 6;
+ m [ PC::make(9) ] = 7;
+ m [ PC::make(11) ] = 8;
+ m [ PC::make(13) ] = 9;
+ m [ PC::make(15) ] = 10;
+ m [ PC::make(17) ] = 11;
+ m [ PC::make(19) ] = 12;
+
+ 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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -163,4 +164,77 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(6) ] = 6;
+ m [ PC::make(7) ] = 7;
+ m [ PC::make(8) ] = 8;
+ m [ PC::make(9) ] = 9;
+ m [ PC::make(10) ] = 10;
+ m [ PC::make(11) ] = 11;
+ m [ PC::make(12) ] = 12;
+
+ 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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -227,4 +228,109 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less <>> 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 PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(7) ] = 6;
+ m [ PC::make(9) ] = 7;
+ m [ PC::make(11) ] = 8;
+ m [ PC::make(13) ] = 9;
+ m [ PC::make(15) ] = 10;
+ m [ PC::make(17) ] = 11;
+ m [ PC::make(19) ] = 12;
+
+ 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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -227,4 +228,108 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(7) ] = 6;
+ m [ PC::make(9) ] = 7;
+ m [ PC::make(11) ] = 8;
+ m [ PC::make(13) ] = 9;
+ m [ PC::make(15) ] = 10;
+ m [ PC::make(17) ] = 11;
+ m [ PC::make(19) ] = 12;
+
+ 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/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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -178,4 +179,86 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+// assert(m.size() == 9);
+ 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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -142,4 +143,67 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+ 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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -150,4 +151,71 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+ 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=188320&r1=188319&r2=188320&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 Tue Aug 13 17:18:47 2013
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -150,4 +151,71 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+ 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/multiset/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp?rev=188320&r1=188319&r2=188320&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/equal_range.pass.cpp Tue Aug 13 17:18:47 2013
@@ -184,47 +184,47 @@ int main()
{
typedef int V;
typedef std::multiset<V, std::less<>> 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::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 PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
- typedef std::pair<M::iterator, M::iterator> R;
+ typedef std::pair<M::iterator, M::iterator> R;
M m;
m.insert ( V::make ( 5 ));
@@ -237,27 +237,27 @@ int main()
m.insert ( V::make ( 9 ));
m.insert ( V::make ( 9 ));
- 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));
+ 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
}
More information about the cfe-commits
mailing list