[libcxx] [test] Strip trailing whitespace, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -23,11 +23,11 @@
|
|||||||
// TEST_CONSTEXPR bool test_constexpr() {
|
// TEST_CONSTEXPR bool test_constexpr() {
|
||||||
// int ia[] = {1, 2, 3, 4, 5};
|
// int ia[] = {1, 2, 3, 4, 5};
|
||||||
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
||||||
//
|
//
|
||||||
// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
|
// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
|
||||||
// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
|
// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
// TEST_CONSTEXPR bool test_constexpr() {
|
// TEST_CONSTEXPR bool test_constexpr() {
|
||||||
// int ia[] = {1, 2, 3, 4, 5};
|
// int ia[] = {1, 2, 3, 4, 5};
|
||||||
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
||||||
//
|
//
|
||||||
// size_t N = std::size(ia);
|
// size_t N = std::size(ia);
|
||||||
// auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N);
|
// auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N);
|
||||||
// return std::equal(std::begin(ic), p, std::begin(ia))
|
// return std::equal(std::begin(ic), p, std::begin(ia))
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@
|
|||||||
// TEST_CONSTEXPR bool test_constexpr() {
|
// TEST_CONSTEXPR bool test_constexpr() {
|
||||||
// int ia[] = {2, 4, 6, 8, 6};
|
// int ia[] = {2, 4, 6, 8, 6};
|
||||||
// int ic[] = {0, 0, 0, 0, 0, 0};
|
// int ic[] = {0, 0, 0, 0, 0, 0};
|
||||||
//
|
//
|
||||||
// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6);
|
// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6);
|
||||||
// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
|
// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 0;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 0;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
// TEST_CONSTEXPR bool test_constexpr() {
|
// TEST_CONSTEXPR bool test_constexpr() {
|
||||||
// int ia[] = {1, 2, 3, 4, 5};
|
// int ia[] = {1, 2, 3, 4, 5};
|
||||||
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
||||||
//
|
//
|
||||||
// auto p = std::copy_n(std::begin(ia), 4, std::begin(ic));
|
// auto p = std::copy_n(std::begin(ia), 4, std::begin(ic));
|
||||||
// return std::equal(std::begin(ic), p, std::begin(ia))
|
// return std::equal(std::begin(ic), p, std::begin(ia))
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {0, 1, 2, 3, 4};
|
int ia[] = {0, 1, 2, 3, 4};
|
||||||
|
|
||||||
std::fill(std::begin(ia), std::end(ia), 5);
|
std::fill(std::begin(ia), std::end(ia), 5);
|
||||||
|
|
||||||
return std::all_of(std::begin(ia), std::end(ia), [](int a) {return a == 5; })
|
return std::all_of(std::begin(ia), std::end(ia), [](int a) {return a == 5; })
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const size_t N = 5;
|
const size_t N = 5;
|
||||||
int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
|
int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
|
||||||
|
|
||||||
auto it = std::fill_n(std::begin(ib), N, 5);
|
auto it = std::fill_n(std::begin(ib), N, 5);
|
||||||
return it == (std::begin(ib) + N)
|
return it == (std::begin(ib) + N)
|
||||||
&& std::all_of(std::begin(ib), it, [](int a) {return a == 5; })
|
&& std::all_of(std::begin(ib), it, [](int a) {return a == 5; })
|
||||||
&& *it == 0 // don't overwrite the last value in the output array
|
&& *it == 0 // don't overwrite the last value in the output array
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {0, 1, 2, 3, 4};
|
int ia[] = {0, 1, 2, 3, 4};
|
||||||
|
|
||||||
std::generate(std::begin(ia), std::end(ia), gen_test());
|
std::generate(std::begin(ia), std::end(ia), gen_test());
|
||||||
|
|
||||||
return std::all_of(std::begin(ia), std::end(ia), [](int x) { return x == 1; })
|
return std::all_of(std::begin(ia), std::end(ia), [](int x) { return x == 1; })
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
|
int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
|
||||||
|
|
||||||
auto it = std::generate_n(std::begin(ib), N, gen_test());
|
auto it = std::generate_n(std::begin(ib), N, gen_test());
|
||||||
|
|
||||||
return it == (std::begin(ib) + N)
|
return it == (std::begin(ib) + N)
|
||||||
&& std::all_of(std::begin(ib), it, [](int x) { return x == 2; })
|
&& std::all_of(std::begin(ib), it, [](int x) { return x == 2; })
|
||||||
&& *it == 0 // don't overwrite the last value in the output array
|
&& *it == 0 // don't overwrite the last value in the output array
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {1, 3, 5, 2, 4, 6};
|
int ia[] = {1, 3, 5, 2, 4, 6};
|
||||||
int r1[10] = {0};
|
int r1[10] = {0};
|
||||||
int r2[10] = {0};
|
int r2[10] = {0};
|
||||||
|
|
||||||
auto p = std::partition_copy(std::begin(ia), std::end(ia),
|
auto p = std::partition_copy(std::begin(ia), std::end(ia),
|
||||||
std::begin(r1), std::begin(r2), is_odd());
|
std::begin(r1), std::begin(r2), is_odd());
|
||||||
|
|
||||||
return std::all_of(std::begin(r1), p.first, is_odd())
|
return std::all_of(std::begin(r1), p.first, is_odd())
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#if TEST_STD_VER > 17
|
#if TEST_STD_VER > 17
|
||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {1, 3, 5, 2, 5, 6};
|
int ia[] = {1, 3, 5, 2, 5, 6};
|
||||||
|
|
||||||
auto it = std::remove(std::begin(ia), std::end(ia), 5);
|
auto it = std::remove(std::begin(ia), std::end(ia), 5);
|
||||||
|
|
||||||
return (std::begin(ia) + std::size(ia) - 2) == it // we removed two elements
|
return (std::begin(ia) + std::size(ia) - 2) == it // we removed two elements
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {1, 3, 5, 2, 5, 6};
|
int ia[] = {1, 3, 5, 2, 5, 6};
|
||||||
int ib[std::size(ia)] = {0};
|
int ib[std::size(ia)] = {0};
|
||||||
|
|
||||||
auto it = std::remove_copy(std::begin(ia), std::end(ia), std::begin(ib), 5);
|
auto it = std::remove_copy(std::begin(ia), std::end(ia), std::begin(ib), 5);
|
||||||
|
|
||||||
return std::distance(std::begin(ib), it) == (std::size(ia) - 2) // we removed two elements
|
return std::distance(std::begin(ib), it) == (std::size(ia) - 2) // we removed two elements
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CONSTEXPR bool equalToTwo(int v) { return v == 2; }
|
|||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {1, 3, 5, 2, 5, 6};
|
int ia[] = {1, 3, 5, 2, 5, 6};
|
||||||
int ib[std::size(ia)] = {0};
|
int ib[std::size(ia)] = {0};
|
||||||
|
|
||||||
auto it = std::remove_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo);
|
auto it = std::remove_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo);
|
||||||
|
|
||||||
return std::distance(std::begin(ib), it) == (std::size(ia) - 1) // we removed one element
|
return std::distance(std::begin(ib), it) == (std::size(ia) - 1) // we removed one element
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ TEST_CONSTEXPR bool equal2 ( int i ) { return i == 2; }
|
|||||||
#if TEST_STD_VER > 17
|
#if TEST_STD_VER > 17
|
||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {1, 3, 5, 2, 5, 6};
|
int ia[] = {1, 3, 5, 2, 5, 6};
|
||||||
|
|
||||||
auto it = std::remove_if(std::begin(ia), std::end(ia), equal2);
|
auto it = std::remove_if(std::begin(ia), std::end(ia), equal2);
|
||||||
|
|
||||||
return (std::begin(ia) + std::size(ia) - 1) == it // we removed one element
|
return (std::begin(ia) + std::size(ia) - 1) == it // we removed one element
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const int expected[] = {0, 1, 5, 3, 4};
|
const int expected[] = {0, 1, 5, 3, 4};
|
||||||
|
|
||||||
auto it = std::replace_copy(std::begin(ia), std::end(ia), std::begin(ib), 2, 5);
|
auto it = std::replace_copy(std::begin(ia), std::end(ia), std::begin(ib), 2, 5);
|
||||||
|
|
||||||
return it == (std::begin(ib) + std::size(ia))
|
return it == (std::begin(ib) + std::size(ia))
|
||||||
&& *it == 0 // don't overwrite the last value in the output array
|
&& *it == 0 // don't overwrite the last value in the output array
|
||||||
&& std::equal(std::begin(ib), it, std::begin(expected), std::end(expected))
|
&& std::equal(std::begin(ib), it, std::begin(expected), std::end(expected))
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const int expected[] = {0, 1, 5, 3, 4};
|
const int expected[] = {0, 1, 5, 3, 4};
|
||||||
|
|
||||||
auto it = std::replace_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo, 5);
|
auto it = std::replace_copy_if(std::begin(ia), std::end(ia), std::begin(ib), equalToTwo, 5);
|
||||||
|
|
||||||
return it == (std::begin(ib) + std::size(ia))
|
return it == (std::begin(ib) + std::size(ia))
|
||||||
&& *it == 0 // don't overwrite the last value in the output array
|
&& *it == 0 // don't overwrite the last value in the output array
|
||||||
&& std::equal(std::begin(ib), it, std::begin(expected), std::end(expected))
|
&& std::equal(std::begin(ib), it, std::begin(expected), std::end(expected))
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {1, 3, 5, 2, 5, 6};
|
int ia[] = {1, 3, 5, 2, 5, 6};
|
||||||
int ib[std::size(ia)] = {0};
|
int ib[std::size(ia)] = {0};
|
||||||
|
|
||||||
auto it = std::reverse_copy(std::begin(ia), std::end(ia), std::begin(ib));
|
auto it = std::reverse_copy(std::begin(ia), std::end(ia), std::begin(ib));
|
||||||
|
|
||||||
return std::distance(std::begin(ib), it) == std::size(ia)
|
return std::distance(std::begin(ib), it) == std::size(ia)
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
// TEST_CONSTEXPR bool test_constexpr() {
|
// TEST_CONSTEXPR bool test_constexpr() {
|
||||||
// int ia[] = {1, 3, 5, 2, 5, 6};
|
// int ia[] = {1, 3, 5, 2, 5, 6};
|
||||||
// int ib[std::size(ia)] = {0};
|
// int ib[std::size(ia)] = {0};
|
||||||
//
|
//
|
||||||
// const size_t N = 2;
|
// const size_t N = 2;
|
||||||
// const auto middle = std::begin(ia) + N;
|
// const auto middle = std::begin(ia) + N;
|
||||||
// auto it = std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib));
|
// auto it = std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib));
|
||||||
//
|
//
|
||||||
// return std::distance(std::begin(ib), it) == std::size(ia)
|
// return std::distance(std::begin(ib), it) == std::size(ia)
|
||||||
// && std::equal (std::begin(ia), middle, std::begin(ib) + std::size(ia) - N)
|
// && std::equal (std::begin(ia), middle, std::begin(ib) + std::size(ia) - N)
|
||||||
// && std::equal (middle, std::end(ia), std::begin(ib))
|
// && std::equal (middle, std::end(ia), std::begin(ib))
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const int ib[] = {2, 4, 7, 8};
|
const int ib[] = {2, 4, 7, 8};
|
||||||
int ic[] = {0, 0, 0, 0, 0}; // one bigger
|
int ic[] = {0, 0, 0, 0, 0}; // one bigger
|
||||||
const int expected[] = {3, 7, 13, 15};
|
const int expected[] = {3, 7, 13, 15};
|
||||||
|
|
||||||
auto it = std::transform(std::begin(ia), std::end(ia),
|
auto it = std::transform(std::begin(ia), std::end(ia),
|
||||||
std::begin(ib), std::begin(ic), std::plus<int>());
|
std::begin(ib), std::begin(ic), std::plus<int>());
|
||||||
|
|
||||||
return it == (std::begin(ic) + std::size(ia))
|
return it == (std::begin(ic) + std::size(ia))
|
||||||
&& *it == 0 // don't overwrite the last value in the output array
|
&& *it == 0 // don't overwrite the last value in the output array
|
||||||
&& std::equal(std::begin(expected), std::end(expected), std::begin(ic), it)
|
&& std::equal(std::begin(expected), std::end(expected), std::begin(ic), it)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const int expected[] = {2, 4, 7, 8};
|
const int expected[] = {2, 4, 7, 8};
|
||||||
|
|
||||||
auto it = std::transform(std::begin(ia), std::end(ia), std::begin(ib), plusOne);
|
auto it = std::transform(std::begin(ia), std::end(ia), std::begin(ib), plusOne);
|
||||||
|
|
||||||
return it == (std::begin(ib) + std::size(ia))
|
return it == (std::begin(ib) + std::size(ia))
|
||||||
&& *it == 0 // don't overwrite the last value in the output array
|
&& *it == 0 // don't overwrite the last value in the output array
|
||||||
&& std::equal(std::begin(ib), it, std::begin(expected), std::end(expected))
|
&& std::equal(std::begin(ib), it, std::begin(expected), std::end(expected))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {0, 1, 1, 3, 4};
|
int ia[] = {0, 1, 1, 3, 4};
|
||||||
const int expected[] = {0, 1, 3, 4};
|
const int expected[] = {0, 1, 3, 4};
|
||||||
const size_t N = 4;
|
const size_t N = 4;
|
||||||
|
|
||||||
auto it = std::unique(std::begin(ia), std::end(ia));
|
auto it = std::unique(std::begin(ia), std::end(ia));
|
||||||
return it == (std::begin(ia) + N)
|
return it == (std::begin(ia) + N)
|
||||||
&& std::equal(std::begin(ia), it, std::begin(expected), std::end(expected))
|
&& std::equal(std::begin(ia), it, std::begin(expected), std::end(expected))
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
typedef forward_iterator<int*> FI;
|
typedef forward_iterator<int*> FI;
|
||||||
typedef bidirectional_iterator<int*> BI;
|
typedef bidirectional_iterator<int*> BI;
|
||||||
typedef random_access_iterator<int*> RI;
|
typedef random_access_iterator<int*> RI;
|
||||||
|
|
||||||
return (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+15))
|
return (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+15))
|
||||||
&& (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic)))
|
&& (std::find_end(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic)))
|
||||||
&& (std::find_end(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+15))
|
&& (std::find_end(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+15))
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
typedef forward_iterator<int*> FI;
|
typedef forward_iterator<int*> FI;
|
||||||
typedef bidirectional_iterator<int*> BI;
|
typedef bidirectional_iterator<int*> BI;
|
||||||
typedef random_access_iterator<int*> RI;
|
typedef random_access_iterator<int*> RI;
|
||||||
|
|
||||||
return (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+1))
|
return (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ia)), FI(std::end(ia))) == FI(ic+1))
|
||||||
&& (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic)))
|
&& (std::find_first_of(FI(std::begin(ic)), FI(std::end(ic)), FI(std::begin(ib)), FI(std::end(ib))) == FI(std::end(ic)))
|
||||||
&& (std::find_first_of(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+1))
|
&& (std::find_first_of(BI(std::begin(ic)), BI(std::end(ic)), BI(std::begin(ia)), BI(std::end(ia))) == BI(ic+1))
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {1, 3, 6, 7};
|
int ia[] = {1, 3, 6, 7};
|
||||||
int expected[] = {3, 5, 8, 9};
|
int expected[] = {3, 5, 8, 9};
|
||||||
const size_t N = 4;
|
const size_t N = 4;
|
||||||
|
|
||||||
auto it = std::for_each_n(std::begin(ia), N, [](int &a) { a += 2; });
|
auto it = std::for_each_n(std::begin(ia), N, [](int &a) { a += 2; });
|
||||||
return it == (std::begin(ia) + N)
|
return it == (std::begin(ia) + N)
|
||||||
&& std::equal(std::begin(ia), std::end(ia), std::begin(expected))
|
&& std::equal(std::begin(ia), std::end(ia), std::begin(expected))
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic));
|
auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic));
|
||||||
if (p1.first != ia+2 || p1.second != ic+2)
|
if (p1.first != ia+2 || p1.second != ic+2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic));
|
auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic));
|
||||||
if (p2.first != ia+2 || p2.second != ic+2)
|
if (p2.first != ia+2 || p2.second != ic+2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic));
|
auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic));
|
||||||
if (p3.first != ib+2 || p3.second != ic+2)
|
if (p3.first != ib+2 || p3.second != ic+2)
|
||||||
return false;
|
return false;
|
||||||
@@ -55,7 +55,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
if (p6.first != BI(ib+2) || p6.second != BI(ic+2))
|
if (p6.first != BI(ib+2) || p6.second != BI(ic+2))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), eq);
|
auto p1 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), eq);
|
||||||
if (p1.first != ia+2 || p1.second != ic+2)
|
if (p1.first != ia+2 || p1.second != ic+2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), eq);
|
auto p2 = std::mismatch(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), eq);
|
||||||
if (p2.first != ia+2 || p2.second != ic+2)
|
if (p2.first != ia+2 || p2.second != ic+2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic), eq);
|
auto p3 = std::mismatch(std::begin(ib), std::end(ib), std::begin(ic), eq);
|
||||||
if (p3.first != ib+2 || p3.second != ic+2)
|
if (p3.first != ib+2 || p3.second != ic+2)
|
||||||
return false;
|
return false;
|
||||||
@@ -60,7 +60,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
if (p6.first != BI(ib+2) || p6.second != BI(ic+2))
|
if (p6.first != BI(ib+2) || p6.second != BI(ic+2))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
// int ib[] = {2, 4, 6, 8};
|
// int ib[] = {2, 4, 6, 8};
|
||||||
// int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
// int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
// const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
|
// const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
|
||||||
//
|
//
|
||||||
// auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(ic));
|
// auto it = std::merge(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), std::begin(ic));
|
||||||
// return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
|
// return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
|
||||||
// && *it == 0
|
// && *it == 0
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
// int ib[] = {2, 4, 6, 8};
|
// int ib[] = {2, 4, 6, 8};
|
||||||
// int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
// int ic[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
// const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
|
// const int expected[] = {0, 1, 2, 2, 3, 4, 4, 6, 8};
|
||||||
//
|
//
|
||||||
// auto it = std::merge(std::begin(ia), std::end(ia),
|
// auto it = std::merge(std::begin(ia), std::end(ia),
|
||||||
// std::begin(ib), std::end(ib),
|
// std::begin(ib), std::end(ib),
|
||||||
// std::begin(ic), [](int a, int b) {return a == b; });
|
// std::begin(ic), [](int a, int b) {return a == b; });
|
||||||
// return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
|
// return std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib))
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
||||||
int ib[] = {2, 4};
|
int ib[] = {2, 4};
|
||||||
int ic[] = {3, 3, 3, 3};
|
int ic[] = {3, 3, 3, 3};
|
||||||
|
|
||||||
return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib))
|
return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib))
|
||||||
&& !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic))
|
&& !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic))
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
||||||
int ib[] = {2, 4};
|
int ib[] = {2, 4};
|
||||||
int ic[] = {3, 3, 3, 3};
|
int ic[] = {3, 3, 3, 3};
|
||||||
|
|
||||||
auto comp = [](int a, int b) {return a < b; };
|
auto comp = [](int a, int b) {return a < b; };
|
||||||
return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), comp)
|
return std::includes(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib), comp)
|
||||||
&& !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), comp)
|
&& !std::includes(std::begin(ia), std::end(ia), std::begin(ic), std::end(ic), comp)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
||||||
const int ib[] = {2, 4, 4, 6};
|
const int ib[] = {2, 4, 4, 6};
|
||||||
int results[std::size(ia)] = {0};
|
int results[std::size(ia)] = {0};
|
||||||
|
|
||||||
auto it = std::set_intersection(std::begin(ia), std::end(ia),
|
auto it = std::set_intersection(std::begin(ia), std::end(ia),
|
||||||
std::begin(ib), std::end(ib), std::begin(results));
|
std::begin(ib), std::end(ib), std::begin(results));
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ TEST_CONSTEXPR bool test_constexpr() {
|
|||||||
const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
const int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
|
||||||
const int ib[] = {2, 4, 4, 6};
|
const int ib[] = {2, 4, 4, 6};
|
||||||
int results[std::size(ia)] = {0};
|
int results[std::size(ia)] = {0};
|
||||||
|
|
||||||
auto comp = [](int a, int b) {return a < b; };
|
auto comp = [](int a, int b) {return a < b; };
|
||||||
auto it = std::set_intersection(std::begin(ia), std::end(ia),
|
auto it = std::set_intersection(std::begin(ia), std::end(ia),
|
||||||
std::begin(ib), std::end(ib), std::begin(results), comp);
|
std::begin(ib), std::end(ib), std::begin(results), comp);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void test_return_type() {
|
|||||||
typedef typename Queue::container_type Container;
|
typedef typename Queue::container_type Container;
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename Container::value_type value_type;
|
||||||
typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
|
typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
|
||||||
|
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
|
typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
|
||||||
static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
|
static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
|
||||||
@@ -42,7 +42,7 @@ int main()
|
|||||||
{
|
{
|
||||||
test_return_type<std::queue<int> > ();
|
test_return_type<std::queue<int> > ();
|
||||||
test_return_type<std::queue<int, std::list<int> > > ();
|
test_return_type<std::queue<int, std::list<int> > > ();
|
||||||
|
|
||||||
typedef Emplaceable T;
|
typedef Emplaceable T;
|
||||||
std::queue<Emplaceable> q;
|
std::queue<Emplaceable> q;
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void test_return_type() {
|
|||||||
typedef typename Stack::container_type Container;
|
typedef typename Stack::container_type Container;
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename Container::value_type value_type;
|
||||||
typedef decltype(std::declval<Stack>().emplace(std::declval<value_type &>())) stack_return_type;
|
typedef decltype(std::declval<Stack>().emplace(std::declval<value_type &>())) stack_return_type;
|
||||||
|
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
|
typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
|
||||||
static_assert(std::is_same<stack_return_type, container_return_type>::value, "");
|
static_assert(std::is_same<stack_return_type, container_return_type>::value, "");
|
||||||
@@ -43,7 +43,7 @@ int main()
|
|||||||
test_return_type<std::stack<int, std::vector<int> > > ();
|
test_return_type<std::stack<int, std::vector<int> > > ();
|
||||||
|
|
||||||
typedef Emplaceable T;
|
typedef Emplaceable T;
|
||||||
std::stack<Emplaceable> q;
|
std::stack<Emplaceable> q;
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
T& r1 = q.emplace(1, 2.5);
|
T& r1 = q.emplace(1, 2.5);
|
||||||
assert(&r1 == &q.top());
|
assert(&r1 == &q.top());
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ template <typename T>
|
|||||||
struct throwingLess {
|
struct throwingLess {
|
||||||
throwingLess() : num_(1) {}
|
throwingLess() : num_(1) {}
|
||||||
throwingLess(int num) : num_(num) {}
|
throwingLess(int num) : num_(num) {}
|
||||||
|
|
||||||
bool operator() (const T& lhs, const T& rhs) const
|
bool operator() (const T& lhs, const T& rhs) const
|
||||||
{
|
{
|
||||||
if ( --num_ == 0) throw 1;
|
if ( --num_ == 0) throw 1;
|
||||||
return lhs < rhs;
|
return lhs < rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutable int num_;
|
mutable int num_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
// using size_type = size_t;
|
// using size_type = size_t;
|
||||||
// using difference_type = ptrdiff_t;
|
// using difference_type = ptrdiff_t;
|
||||||
// static constexpr size_type npos = size_type(-1);
|
// static constexpr size_type npos = size_type(-1);
|
||||||
//
|
//
|
||||||
// };
|
// };
|
||||||
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ int main() {
|
|||||||
static_assert( std::endian::little != std::endian::big );
|
static_assert( std::endian::little != std::endian::big );
|
||||||
|
|
||||||
// Technically not required, but true on all existing machines
|
// Technically not required, but true on all existing machines
|
||||||
static_assert( std::endian::native == std::endian::little ||
|
static_assert( std::endian::native == std::endian::little ||
|
||||||
std::endian::native == std::endian::big );
|
std::endian::native == std::endian::big );
|
||||||
|
|
||||||
// Try to check at runtime
|
// Try to check at runtime
|
||||||
{
|
{
|
||||||
uint32_t i = 0x01020304;
|
uint32_t i = 0x01020304;
|
||||||
|
|||||||
@@ -25,13 +25,13 @@
|
|||||||
#if TEST_STD_VER > 17
|
#if TEST_STD_VER > 17
|
||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int v = 12;
|
int v = 12;
|
||||||
|
|
||||||
if (12 != std::exchange(v,23) || v != 23)
|
if (12 != std::exchange(v,23) || v != 23)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (23 != std::exchange(v,static_cast<short>(67)) || v != 67)
|
if (23 != std::exchange(v,static_cast<short>(67)) || v != 67)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (67 != std::exchange<int, short>(v, {}) || v != 0)
|
if (67 != std::exchange<int, short>(v, {}) || v != 0)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user