Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113086 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -27,7 +27,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void test(unsigned N)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ int main()
|
||||
test(10);
|
||||
test(1000);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
const int N = 1000;
|
||||
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
|
||||
@@ -60,5 +60,5 @@ int main()
|
||||
assert(std::is_heap(ia, ia+N, indirect_less()));
|
||||
delete [] ia;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -27,7 +27,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void test(unsigned N)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ int main()
|
||||
{
|
||||
test(1000);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
const int N = 1000;
|
||||
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
|
||||
@@ -64,5 +64,5 @@ int main()
|
||||
}
|
||||
delete [] ia;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -28,7 +28,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void test(unsigned N)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ int main()
|
||||
{
|
||||
test(1000);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
const int N = 1000;
|
||||
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
|
||||
@@ -62,5 +62,5 @@ int main()
|
||||
}
|
||||
delete [] ia;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -27,7 +27,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void test(unsigned N)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ int main()
|
||||
test(10);
|
||||
test(1000);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
const int N = 1000;
|
||||
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
|
||||
@@ -62,5 +62,5 @@ int main()
|
||||
assert(std::is_sorted(ia, ia+N, indirect_less()));
|
||||
delete [] ia;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -28,7 +28,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#include "../../iterators.h"
|
||||
|
||||
@@ -89,7 +89,7 @@ int main()
|
||||
test<random_access_iterator<int*> >();
|
||||
test<int*>();
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
unsigned N = 100;
|
||||
unsigned M = 50;
|
||||
@@ -108,5 +108,5 @@ int main()
|
||||
}
|
||||
delete [] ia;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
int i = std::max({2, 3, 1});
|
||||
assert(i == 3);
|
||||
i = std::max({2, 1, 3});
|
||||
@@ -31,5 +31,5 @@ int main()
|
||||
assert(i == 3);
|
||||
i = std::max({1, 3, 2});
|
||||
assert(i == 3);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
int i = std::max({2, 3, 1}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
i = std::max({2, 1, 3}, std::greater<int>());
|
||||
@@ -32,5 +32,5 @@ int main()
|
||||
assert(i == 1);
|
||||
i = std::max({1, 3, 2}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
int i = std::min({2, 3, 1});
|
||||
assert(i == 1);
|
||||
i = std::min({2, 1, 3});
|
||||
@@ -31,5 +31,5 @@ int main()
|
||||
assert(i == 1);
|
||||
i = std::min({1, 3, 2});
|
||||
assert(i == 1);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
int i = std::min({2, 3, 1}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
i = std::min({2, 1, 3}, std::greater<int>());
|
||||
@@ -32,5 +32,5 @@ int main()
|
||||
assert(i == 3);
|
||||
i = std::min({1, 3, 2}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -18,12 +18,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
|
||||
assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)));
|
||||
assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)));
|
||||
assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)));
|
||||
assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)));
|
||||
assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)));
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,12 +19,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -29,7 +29,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void
|
||||
test_one(unsigned N, unsigned M)
|
||||
@@ -73,7 +73,7 @@ int main()
|
||||
test(1000);
|
||||
test(1009);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::vector<std::unique_ptr<int> > v(1000);
|
||||
for (int i = 0; i < v.size(); ++i)
|
||||
@@ -81,5 +81,5 @@ int main()
|
||||
std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
|
||||
assert(*v[v.size()/2] == v.size()/2);
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -29,7 +29,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void
|
||||
test_larger_sorts(unsigned N, unsigned M)
|
||||
@@ -74,7 +74,7 @@ int main()
|
||||
test_larger_sorts(1000);
|
||||
test_larger_sorts(1009);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::vector<std::unique_ptr<int> > v(1000);
|
||||
for (int i = 0; i < v.size(); ++i)
|
||||
@@ -83,5 +83,5 @@ int main()
|
||||
for (int i = 0; i < v.size()/2; ++i)
|
||||
assert(*v[i] == i);
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -29,7 +29,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -42,7 +42,7 @@ int main()
|
||||
assert(std::is_sorted(v.begin(), v.end()));
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::vector<std::unique_ptr<int> > v(1000);
|
||||
for (int i = 0; i < v.size(); ++i)
|
||||
@@ -53,5 +53,5 @@ int main()
|
||||
assert(*v[1] == 1);
|
||||
assert(*v[2] == 2);
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <memory>
|
||||
|
||||
struct indirect_less
|
||||
@@ -29,7 +29,7 @@ struct indirect_less
|
||||
{return *x < *y;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
struct first_only
|
||||
{
|
||||
@@ -68,7 +68,7 @@ int main()
|
||||
{
|
||||
test();
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::vector<std::unique_ptr<int> > v(1000);
|
||||
for (int i = 0; i < v.size(); ++i)
|
||||
@@ -79,5 +79,5 @@ int main()
|
||||
assert(*v[1] == 1);
|
||||
assert(*v[2] == 2);
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
Reference in New Issue
Block a user