File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
libcxx/test/std/containers/container.adaptors/flat.multiset Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 31
31
#include " test_container_comparisons.h"
32
32
33
33
template <class KeyContainer >
34
- void test_one () {
34
+ constexpr void test_one () {
35
35
using Key = typename KeyContainer::value_type;
36
36
37
37
{
@@ -64,9 +64,12 @@ void test_one() {
64
64
}
65
65
}
66
66
67
- void test () {
67
+ constexpr bool test () {
68
68
test_one<std::vector<int >>();
69
- test_one<std::deque<int >>();
69
+ #ifndef __cpp_lib_constexpr_deque
70
+ if (!TEST_IS_CONSTANT_EVALUATED)
71
+ #endif
72
+ test_one<std::deque<int >>();
70
73
test_one<MinSequenceContainer<int >>();
71
74
test_one<std::vector<int , min_allocator<int >>>();
72
75
@@ -81,7 +84,7 @@ void test() {
81
84
{
82
85
// Comparisons use value_type's native operators, not the comparator
83
86
struct StrongComp {
84
- bool operator ()(double a, double b) const { return std::strong_order (a, b) < 0 ; }
87
+ constexpr bool operator ()(double a, double b) const { return std::strong_order (a, b) < 0 ; }
85
88
};
86
89
using C = std::flat_multiset<double , StrongComp>;
87
90
C s1 = {1 };
@@ -96,10 +99,15 @@ void test() {
96
99
assert (s1 != s2);
97
100
assert ((s1 <=> s2) == std::partial_ordering::unordered);
98
101
}
102
+
103
+ return true ;
99
104
}
100
105
101
106
int main (int , char **) {
102
107
test ();
108
+ #if TEST_STD_VER >= 26
109
+ static_assert (test ());
110
+ #endif
103
111
104
112
return 0 ;
105
113
}
You can’t perform that action at this time.
0 commit comments