Revert "Merge to upstream r304942."
This reverts commit83b1388ecd, reversing changes made tof20819f925. Test: treehugger Bug: None
This commit is contained in:
@@ -16,9 +16,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
@@ -37,7 +38,8 @@ test()
|
||||
assert(ia[i] == ib[i]);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
void
|
||||
test1()
|
||||
@@ -53,7 +55,8 @@ test1()
|
||||
for (unsigned i = 0; i < N; ++i)
|
||||
assert(*ib[i] == static_cast<int>(i));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -92,7 +95,7 @@ int main()
|
||||
test<const int*, random_access_iterator<int*> >();
|
||||
test<const int*, int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test1<input_iterator<std::unique_ptr<int>*>, output_iterator<std::unique_ptr<int>*> >();
|
||||
test1<input_iterator<std::unique_ptr<int>*>, input_iterator<std::unique_ptr<int>*> >();
|
||||
test1<input_iterator<std::unique_ptr<int>*>, forward_iterator<std::unique_ptr<int>*> >();
|
||||
@@ -127,5 +130,5 @@ int main()
|
||||
test1<std::unique_ptr<int>*, bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*, random_access_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*, std::unique_ptr<int>*>();
|
||||
#endif // TEST_STD_VER >= 11
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
@@ -37,7 +38,8 @@ test()
|
||||
assert(ia[i] == ib[i]);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
void
|
||||
test1()
|
||||
@@ -53,7 +55,8 @@ test1()
|
||||
for (unsigned i = 0; i < N; ++i)
|
||||
assert(*ib[i] == static_cast<int>(i));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -69,7 +72,7 @@ int main()
|
||||
test<const int*, random_access_iterator<int*> >();
|
||||
test<const int*, int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
test1<bidirectional_iterator<std::unique_ptr<int>*>, bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<bidirectional_iterator<std::unique_ptr<int>*>, random_access_iterator<std::unique_ptr<int>*> >();
|
||||
test1<bidirectional_iterator<std::unique_ptr<int>*>, std::unique_ptr<int>*>();
|
||||
@@ -81,5 +84,5 @@ int main()
|
||||
test1<std::unique_ptr<int>*, bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*, random_access_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*, std::unique_ptr<int>*>();
|
||||
#endif // TEST_STD_VER >= 11
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <algorithm>
|
||||
// REQUIRES: c++98 || c++03 || c++11 || c++14
|
||||
|
||||
// template<RandomAccessIterator Iter>
|
||||
// requires ShuffleIterator<Iter>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <algorithm>
|
||||
// REQUIRES: c++98 || c++03 || c++11 || c++14
|
||||
|
||||
// template<RandomAccessIterator Iter, Callable<auto, Iter::difference_type> Rand>
|
||||
// requires ShuffleIterator<Iter>
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
template <class Iter>
|
||||
@@ -38,7 +39,8 @@ test()
|
||||
assert(ia[5] == 4);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test1()
|
||||
@@ -60,7 +62,8 @@ test1()
|
||||
assert(*ia[4] == 3);
|
||||
assert(*ia[5] == 4);
|
||||
}
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -69,10 +72,12 @@ int main()
|
||||
test<random_access_iterator<int*> >();
|
||||
test<int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1<forward_iterator<std::unique_ptr<int>*> >();
|
||||
test1<bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<random_access_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*>();
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
bool equalToTwo(int v) { return v == 2; }
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
void
|
||||
test()
|
||||
@@ -30,8 +28,8 @@ test()
|
||||
int ia[] = {0, 1, 2, 3, 4, 2, 3, 4, 2};
|
||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
||||
int ib[sa];
|
||||
OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa),
|
||||
OutIter(ib), equalToTwo);
|
||||
OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib),
|
||||
std::bind2nd(std::equal_to<int>(), 2));
|
||||
assert(base(r) == ib + sa-3);
|
||||
assert(ib[0] == 0);
|
||||
assert(ib[1] == 1);
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
#include "counting_predicates.hpp"
|
||||
|
||||
@@ -45,7 +46,8 @@ test()
|
||||
assert(cp.count() == sa);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
struct pred
|
||||
{
|
||||
bool operator()(const std::unique_ptr<int>& i) {return *i == 2;}
|
||||
@@ -75,7 +77,8 @@ test1()
|
||||
assert(*ia[4] == 3);
|
||||
assert(*ia[5] == 4);
|
||||
}
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -84,10 +87,12 @@ int main()
|
||||
test<random_access_iterator<int*> >();
|
||||
test<int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1<forward_iterator<std::unique_ptr<int>*> >();
|
||||
test1<bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<random_access_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*>();
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
bool equalToTwo(int v) { return v == 2; }
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
void
|
||||
test()
|
||||
@@ -32,8 +30,8 @@ test()
|
||||
int ia[] = {0, 1, 2, 3, 4};
|
||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
||||
int ib[sa] = {0};
|
||||
OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa),
|
||||
OutIter(ib), equalToTwo, 5);
|
||||
OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib),
|
||||
std::bind2nd(std::equal_to<int>(), 2), 5);
|
||||
assert(base(r) == ib + sa);
|
||||
assert(ib[0] == 0);
|
||||
assert(ib[1] == 1);
|
||||
|
||||
@@ -22,15 +22,13 @@
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
bool equalToTwo(int v) { return v == 2; }
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test()
|
||||
{
|
||||
int ia[] = {0, 1, 2, 3, 4};
|
||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
||||
std::replace_if(Iter(ia), Iter(ia+sa), equalToTwo, 5);
|
||||
std::replace_if(Iter(ia), Iter(ia+sa), std::bind2nd(std::equal_to<int>(), 2), 5);
|
||||
assert(ia[0] == 0);
|
||||
assert(ia[1] == 1);
|
||||
assert(ia[2] == 5);
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
template<class Iter1, class Iter2>
|
||||
@@ -37,7 +38,8 @@ test()
|
||||
assert(j[2] == 3);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class Iter1, class Iter2>
|
||||
void
|
||||
test1()
|
||||
@@ -57,7 +59,8 @@ test1()
|
||||
assert(*j[1] == 2);
|
||||
assert(*j[2] == 3);
|
||||
}
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void test2()
|
||||
{
|
||||
@@ -128,7 +131,8 @@ int main()
|
||||
test<int*, random_access_iterator<int*> >();
|
||||
test<int*, int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1<forward_iterator<std::unique_ptr<int>*>, forward_iterator<std::unique_ptr<int>*> >();
|
||||
test1<forward_iterator<std::unique_ptr<int>*>, bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<forward_iterator<std::unique_ptr<int>*>, random_access_iterator<std::unique_ptr<int>*> >();
|
||||
@@ -148,7 +152,8 @@ int main()
|
||||
test1<std::unique_ptr<int>*, bidirectional_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*, random_access_iterator<std::unique_ptr<int>*> >();
|
||||
test1<std::unique_ptr<int>*, std::unique_ptr<int>*>();
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test2();
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
int plusOne(int v) { return v + 1; }
|
||||
|
||||
template <class InIter, class OutIter>
|
||||
void
|
||||
test()
|
||||
@@ -30,8 +28,8 @@ test()
|
||||
int ia[] = {0, 1, 2, 3, 4};
|
||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
||||
int ib[sa] = {0};
|
||||
OutIter r = std::transform(InIter(ia), InIter(ia+sa),
|
||||
OutIter(ib), plusOne);
|
||||
OutIter r = std::transform(InIter(ia), InIter(ia+sa), OutIter(ib),
|
||||
std::bind2nd(std::plus<int>(), 1));
|
||||
assert(base(r) == ib + sa);
|
||||
assert(ib[0] == 1);
|
||||
assert(ib[1] == 2);
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
template <class Iter>
|
||||
@@ -83,7 +84,7 @@ test()
|
||||
assert(ii[2] == 2);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
struct do_nothing
|
||||
{
|
||||
@@ -167,7 +168,8 @@ test1()
|
||||
assert(*ii[1] == 1);
|
||||
assert(*ii[2] == 2);
|
||||
}
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -176,10 +178,12 @@ int main()
|
||||
test<random_access_iterator<int*> >();
|
||||
test<int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1<forward_iterator<Ptr*> >();
|
||||
test1<bidirectional_iterator<Ptr*> >();
|
||||
test1<random_access_iterator<Ptr*> >();
|
||||
test1<Ptr*>();
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
struct count_equal
|
||||
@@ -109,7 +110,7 @@ test()
|
||||
assert(count_equal::count == si-1);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
struct do_nothing
|
||||
{
|
||||
@@ -209,7 +210,8 @@ test1()
|
||||
assert(*ii[2] == 2);
|
||||
assert(count_equal::count == si-1);
|
||||
}
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -218,10 +220,12 @@ int main()
|
||||
test<random_access_iterator<int*> >();
|
||||
test<int*>();
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1<forward_iterator<Ptr*> >();
|
||||
test1<bidirectional_iterator<Ptr*> >();
|
||||
test1<random_access_iterator<Ptr*> >();
|
||||
test1<Ptr*>();
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user