mirror of
https://github.com/boostorg/array.git
synced 2025-07-29 12:17:40 +02:00
Add array_elems_test.cpp
This commit is contained in:
@ -29,6 +29,7 @@ run array_hash.cpp
|
||||
#
|
||||
|
||||
run array_typedef_test.cpp ;
|
||||
run array_elems_test.cpp ;
|
||||
|
||||
#
|
||||
|
||||
|
26
test/array_elems_test.cpp
Normal file
26
test/array_elems_test.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
// 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>
|
||||
|
||||
template<class T, std::size_t N> void test()
|
||||
{
|
||||
boost::array<T, N> a = {};
|
||||
|
||||
T (&e)[ N ] = a.elems;
|
||||
|
||||
BOOST_TEST_EQ( static_cast<void const*>( e ), static_cast<void const*>( &a ) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<int, 1>();
|
||||
test<int, 7>();
|
||||
|
||||
test<int const, 1>();
|
||||
test<int const, 7>();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user