/* Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #include #ifdef __cpp_lib_byte #include #include void test_dynamic() { int a[4]; boost::span s = boost::as_bytes(boost::span(&a[0], 4)); BOOST_TEST_EQ(s.data(), reinterpret_cast(&a[0])); BOOST_TEST_EQ(s.size(), sizeof(int) * 4); } void test_static() { int a[4]; boost::span s = boost::as_bytes(boost::span(&a[0], 4)); BOOST_TEST_EQ(s.data(), reinterpret_cast(&a[0])); BOOST_TEST_EQ(s.size(), sizeof(int) * 4); } int main() { test_dynamic(); test_static(); return boost::report_errors(); } #else int main() { return 0; } #endif