@@ -141,6 +141,22 @@ TEST_CASE("span is constructible from std::array (non const data)", "[span]") {
141
141
STATIC_REQUIRE (std::size (s) == 4 );
142
142
}
143
143
144
+ TEST_CASE (" dynamic span is constructible from std::array (const data)" ,
145
+ " [span]" ) {
146
+ constexpr static auto a = std::array{1 , 2 , 3 , 4 };
147
+ auto s = [](stdx::span<int const > x) { return x; }(a);
148
+ CHECK (std::data (s) == std::data (a));
149
+ CHECK (std::size (s) == std::size (a));
150
+ }
151
+
152
+ TEST_CASE (" dynamic span is constructible from std::array (non const data)" ,
153
+ " [span]" ) {
154
+ auto a = std::array{1 , 2 , 3 , 4 };
155
+ auto s = [](stdx::span<int > x) { return x; }(a);
156
+ CHECK (std::data (s) == std::data (a));
157
+ CHECK (std::size (s) == std::size (a));
158
+ }
159
+
144
160
TEST_CASE (" span is constructible from C-style array (const data)" , " [span]" ) {
145
161
constexpr static int a[] = {1 , 2 , 3 , 4 };
146
162
constexpr auto s = stdx::span{a};
@@ -159,6 +175,22 @@ TEST_CASE("span is constructible from C-style array (non const data)",
159
175
CHECK (std::size (s) == std::size (a));
160
176
}
161
177
178
+ TEST_CASE (" dynamic span is constructible from C-style array (const data)" ,
179
+ " [span]" ) {
180
+ constexpr static int a[] = {1 , 2 , 3 , 4 };
181
+ auto s = [](stdx::span<int const > x) { return x; }(a);
182
+ CHECK (std::data (s) == std::data (a));
183
+ CHECK (std::size (s) == std::size (a));
184
+ }
185
+
186
+ TEST_CASE (" dynamic span is constructible from C-style array (non const data)" ,
187
+ " [span]" ) {
188
+ int a[] = {1 , 2 , 3 , 4 };
189
+ auto s = [](stdx::span<int > x) { return x; }(a);
190
+ CHECK (std::data (s) == std::data (a));
191
+ CHECK (std::size (s) == std::size (a));
192
+ }
193
+
162
194
TEST_CASE (" dynamic span is implicitly constructible from range (const data)" ,
163
195
" [span]" ) {
164
196
std::vector const v{1 , 2 , 3 , 4 };
0 commit comments