forked from boostorg/array
Add array_data_test.cpp
This commit is contained in:
@ -33,6 +33,7 @@ run array_elems_test.cpp ;
|
||||
run array_init_test.cpp ;
|
||||
run array_copy_test.cpp ;
|
||||
run array_convert_test.cpp ;
|
||||
run array_data_test.cpp ;
|
||||
|
||||
#
|
||||
|
||||
|
41
test/array_data_test.cpp
Normal file
41
test/array_data_test.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2025 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
template<class T, std::size_t N> void test()
|
||||
{
|
||||
{
|
||||
boost::array<T, N> a = {{}};
|
||||
|
||||
T* p1 = a.data();
|
||||
T* p2 = a.elems;
|
||||
|
||||
BOOST_TEST_EQ( p1, p2 );
|
||||
}
|
||||
|
||||
{
|
||||
boost::array<T, N> const a = {{}};
|
||||
|
||||
T const* p1 = a.data();
|
||||
T const* p2 = a.elems;
|
||||
|
||||
BOOST_TEST_EQ( p1, p2 );
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// test<int, 0>();
|
||||
test<int, 1>();
|
||||
test<int, 7>();
|
||||
|
||||
// test<int const, 0>();
|
||||
test<int const, 1>();
|
||||
test<int const, 7>();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user