summaryrefslogtreecommitdiff
path: root/test/std/containers/sequences/vector.bool
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/sequences/vector.bool')
-rw-r--r--test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/construct_size.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/emplace_back.pass.cpp29
-rw-r--r--test/std/containers/sequences/vector.bool/find.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp25
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/iterators.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/push_back.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/swap.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp18
17 files changed, 86 insertions, 59 deletions
diff --git a/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
index 3d11239702c9..bad80c279d4d 100644
--- a/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -25,7 +26,7 @@ test(Iterator first, Iterator last)
{
C c(first, last);
LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == std::distance(first, last));
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
diff --git a/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
index 196694d73998..dd4a5c757cb5 100644
--- a/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -26,7 +27,7 @@ test(Iterator first, Iterator last, const typename C::allocator_type& a)
{
C c(first, last, a);
LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == std::distance(first, last));
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
diff --git a/test/std/containers/sequences/vector.bool/construct_size.pass.cpp b/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
index 271e4ee33aa4..1fb86a24ab57 100644
--- a/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
@@ -31,6 +31,9 @@ test2(typename C::size_type n,
assert(c.get_allocator() == a);
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
+#else
+ ((void)n);
+ ((void)a);
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/copy.pass.cpp b/test/std/containers/sequences/vector.bool/copy.pass.cpp
index b3cf9b551f96..7e2efad51894 100644
--- a/test/std/containers/sequences/vector.bool/copy.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/copy.pass.cpp
@@ -23,7 +23,7 @@ template <class C>
void
test(const C& x)
{
- unsigned s = x.size();
+ typename C::size_type s = x.size();
C c(x);
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
diff --git a/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
index aa8646a9b819..56ffb7d52dd7 100644
--- a/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
@@ -22,7 +22,7 @@ template <class C>
void
test(const C& x, const typename C::allocator_type& a)
{
- unsigned s = x.size();
+ typename C::size_type s = x.size();
C c(x, a);
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
diff --git a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
index bd2534ad3de7..b8ff33c5d2e8 100644
--- a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -42,6 +43,6 @@ int main()
}
{
typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
index 2950ee3882f1..24005bec82df 100644
--- a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -11,42 +11,57 @@
// <vector>
// vector.bool
-// template <class... Args> void emplace_back(Args&&... args);
+// template <class... Args> reference emplace_back(Args&&... args);
#include <vector>
#include <cassert>
#include "min_allocator.h"
-
int main()
{
{
typedef std::vector<bool> C;
+ typedef C::reference Ref;
C c;
- c.emplace_back();
+ Ref r1 = c.emplace_back();
assert(c.size() == 1);
assert(c.front() == false);
- c.emplace_back(true);
+ r1 = true;
+ assert(c.front() == true);
+ r1 = false;
+ Ref r2 = c.emplace_back(true);
assert(c.size() == 2);
assert(c.front() == false);
assert(c.back() == true);
- c.emplace_back(1 == 1);
+ r2 = false;
+ assert(c.back() == false);
+ r2 = true;
+ Ref r3 = c.emplace_back(1 == 1);
assert(c.size() == 3);
assert(c.front() == false);
assert(c[1] == true);
assert(c.back() == true);
+ r3 = false;
+ assert(c.back() == false);
}
{
typedef std::vector<bool, min_allocator<bool>> C;
+ typedef C::reference Ref;
C c;
- c.emplace_back();
+ Ref r1 = c.emplace_back();
assert(c.size() == 1);
assert(c.front() == false);
- c.emplace_back(true);
+ r1 = true;
+ assert(c.front() == true);
+ r1 = false;
+ Ref r2 = c.emplace_back(true);
assert(c.size() == 2);
assert(c.front() == false);
assert(c.back() == true);
+ r2 = false;
+ assert(c.back() == false);
+ r2 = true;
c.emplace_back(1 == 1);
assert(c.size() == 3);
assert(c.front() == false);
diff --git a/test/std/containers/sequences/vector.bool/find.pass.cpp b/test/std/containers/sequences/vector.bool/find.pass.cpp
index a4b5537d2949..ffe844e0079c 100644
--- a/test/std/containers/sequences/vector.bool/find.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/find.pass.cpp
@@ -17,6 +17,7 @@
#include <vector>
#include <algorithm>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
{
std::vector<bool> b(i,true);
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false);
- assert(j-b.begin() == i);
+ assert(static_cast<std::size_t>(j-b.begin()) == i);
assert(b.end() == j);
}
}
@@ -34,7 +35,7 @@ int main()
{
std::vector<bool> b(i,false);
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true);
- assert(j-b.begin() == i);
+ assert(static_cast<std::size_t>(j-b.begin()) == i);
assert(b.end() == j);
}
}
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
index 89fe7a76d409..dc4fe44d5a39 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
@@ -15,6 +15,9 @@
#include <vector>
#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -28,10 +31,10 @@ int main()
input_iterator<const bool*>(a+N));
assert(v.size() == 100 + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -47,7 +50,7 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
@@ -62,10 +65,10 @@ int main()
forward_iterator<const bool*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -81,10 +84,10 @@ int main()
forward_iterator<const bool*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -98,10 +101,10 @@ int main()
input_iterator<const bool*>(a+N));
assert(v.size() == 100 + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -114,10 +117,10 @@ int main()
forward_iterator<const bool*>(a+N));
assert(v.size() == 100 + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
index 35c57cbd8e42..3ec8952ff150 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -24,7 +25,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -39,7 +40,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == sz + 5);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -55,7 +56,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == sz + 5);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -69,7 +70,7 @@ int main()
std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
index 78ffe7ba73cd..6a4a6d4bcb70 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -24,7 +25,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -38,7 +39,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == sz + 1);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -53,7 +54,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == sz + 1);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -66,7 +67,7 @@ int main()
std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
diff --git a/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/test/std/containers/sequences/vector.bool/iterators.pass.cpp
index 882ac9be4a5d..10b96480a51b 100644
--- a/test/std/containers/sequences/vector.bool/iterators.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/iterators.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -94,7 +95,7 @@ int main()
C::const_iterator j;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
std::vector<bool>::iterator ii1{}, ii2{};
std::vector<bool>::iterator ii4 = ii1;
diff --git a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
index fe53fbfc17e0..dd4bf9e01ea9 100644
--- a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
@@ -21,6 +21,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -60,7 +61,7 @@ int main()
{
{
typedef std::vector<bool> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
@@ -68,12 +69,12 @@ int main()
}
{
typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::vector<bool, some_alloc<bool>> C;
#if TEST_STD_VER > 14
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable<C>::value, "");
#else
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
#endif
@@ -81,7 +82,7 @@ int main()
#if TEST_STD_VER > 14
{ // POCMA false, is_always_equal true
typedef std::vector<bool, some_alloc2<bool>> C;
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable<C>::value, "");
}
{ // POCMA false, is_always_equal false
typedef std::vector<bool, some_alloc3<bool>> C;
diff --git a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
index 2153c7956bfc..3305d95e1ab8 100644
--- a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
@@ -19,6 +19,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -32,21 +33,21 @@ int main()
{
{
typedef std::vector<bool> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::vector<bool, some_alloc<bool>> C;
// In C++17, move constructors for allocators are not allowed to throw
#if TEST_STD_VER > 14
- static_assert( std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT( std::is_nothrow_move_constructible<C>::value, "");
#else
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
#endif
diff --git a/test/std/containers/sequences/vector.bool/push_back.pass.cpp b/test/std/containers/sequences/vector.bool/push_back.pass.cpp
index 3897a438b445..c482f49454be 100644
--- a/test/std/containers/sequences/vector.bool/push_back.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/push_back.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -27,7 +28,7 @@ int main()
{
c.push_back(a[i]);
assert(c.size() == i+1);
- for (int j = 0; j < c.size(); ++j)
+ for (std::size_t j = 0; j < c.size(); ++j)
assert(c[j] == a[j]);
}
}
@@ -40,7 +41,7 @@ int main()
{
c.push_back(a[i]);
assert(c.size() == i+1);
- for (int j = 0; j < c.size(); ++j)
+ for (std::size_t j = 0; j < c.size(); ++j)
assert(c[j] == a[j]);
}
}
diff --git a/test/std/containers/sequences/vector.bool/swap.pass.cpp b/test/std/containers/sequences/vector.bool/swap.pass.cpp
index 81af528f2a9a..60b612ae4f90 100644
--- a/test/std/containers/sequences/vector.bool/swap.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap.pass.cpp
@@ -30,15 +30,15 @@ int main()
}
{
typedef test_allocator<bool> A;
- std::vector<bool, A> v1(100, true, A(1));
- std::vector<bool, A> v2(200, false, A(2));
+ std::vector<bool, A> v1(100, true, A(1, 1));
+ std::vector<bool, A> v2(200, false, A(1, 2));
swap(v1, v2);
assert(v1.size() == 200);
assert(v1.capacity() >= 200);
assert(v2.size() == 100);
assert(v2.capacity() >= 100);
- assert(v1.get_allocator() == A(1));
- assert(v2.get_allocator() == A(2));
+ assert(v1.get_allocator().get_id() == 1);
+ assert(v2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<bool> A;
diff --git a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
index 7ba44453b371..1b68eda2757b 100644
--- a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <vector>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -56,35 +57,30 @@ int main()
{
{
typedef std::vector<bool> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<bool, other_allocator<bool>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<bool, some_alloc<bool>> C;
- C c1, c2;
#if TEST_STD_VER >= 14
// In c++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
}
#if TEST_STD_VER >= 14
{
typedef std::vector<bool, some_alloc2<bool>> C;
- C c1, c2;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}