span support for initializer_list

This commit is contained in:
Glen Fernandes
2023-01-28 09:31:12 -05:00
parent 90231ed7e0
commit 7736b0b8ce
4 changed files with 69 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright 2019 Glen Joseph Fernandes
Copyright 2019-2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
@@ -118,6 +118,14 @@ void test_construct_range()
BOOST_TEST_EQ(s.size(), c.size());
}
void test_construct_initializer_list()
{
std::initializer_list<int> l{1, 2};
boost::span<const int> s(l);
BOOST_TEST_EQ(s.data(), l.begin());
BOOST_TEST_EQ(s.size(), l.size());
}
void test_construct_span_dynamic()
{
int a[4];
@@ -376,6 +384,7 @@ int main()
test_construct_const_std_array_dynamic();
test_construct_const_std_array_static();
test_construct_range();
test_construct_initializer_list();
test_construct_span_dynamic();
test_construct_span_dynamic_static();
test_construct_span_static();