mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-10-23 04:41:40 +02:00
Add overloads to support fixed size arrays, T[N], to allocate_shared (variadic) and make_shared (variadic) and make_shared_noinit.
[SVN r81265]
This commit is contained in:
@@ -47,6 +47,15 @@ int main() {
|
||||
BOOST_TEST(a1[1].i == 9);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[2]> a1 = boost::allocate_shared<type[2]>(std::allocator<type>(), 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
BOOST_TEST(type::instances == 2);
|
||||
BOOST_TEST(a1[0].a == 1);
|
||||
BOOST_TEST(a1[0].d == 4);
|
||||
BOOST_TEST(a1[1].f == 6);
|
||||
BOOST_TEST(a1[1].i == 9);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[][2]> a1 = boost::allocate_shared<type[][2]>(std::allocator<type>(), 2, 1, 2, 3, 4, 5, 6, 7);
|
||||
BOOST_TEST(type::instances == 4);
|
||||
@@ -56,6 +65,15 @@ int main() {
|
||||
BOOST_TEST(a1[1][1].i == 0);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[2][2]> a1 = boost::allocate_shared<type[2][2]>(std::allocator<type>(), 1, 2, 3, 4, 5, 6, 7);
|
||||
BOOST_TEST(type::instances == 4);
|
||||
BOOST_TEST(a1[0][0].a == 1);
|
||||
BOOST_TEST(a1[0][1].d == 4);
|
||||
BOOST_TEST(a1[1][0].f == 6);
|
||||
BOOST_TEST(a1[1][1].i == 0);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[][2][2]> a1 = boost::allocate_shared<type[][2][2]>(std::allocator<type>(), 2, 1, 2, 3, 4, 5);
|
||||
BOOST_TEST(type::instances == 8);
|
||||
@@ -65,6 +83,15 @@ int main() {
|
||||
BOOST_TEST(a1[1][1][1].i == 0);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[2][2][2]> a1 = boost::allocate_shared<type[2][2][2]>(std::allocator<type>(), 1, 2, 3, 4, 5);
|
||||
BOOST_TEST(type::instances == 8);
|
||||
BOOST_TEST(a1[0][0][0].a == 1);
|
||||
BOOST_TEST(a1[0][1][0].c == 3);
|
||||
BOOST_TEST(a1[1][0][1].e == 5);
|
||||
BOOST_TEST(a1[1][1][1].i == 0);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[][2][2][2]> a1 = boost::allocate_shared<type[][2][2][2]>(std::allocator<type>(), 2, 1, 2, 3);
|
||||
BOOST_TEST(type::instances == 16);
|
||||
@@ -73,6 +100,15 @@ int main() {
|
||||
BOOST_TEST(a1[0][1][0][0].f == 0);
|
||||
BOOST_TEST(a1[1][0][0][0].i == 0);
|
||||
}
|
||||
BOOST_TEST(type::instances == 0);
|
||||
{
|
||||
boost::shared_ptr<type[2][2][2][2]> a1 = boost::allocate_shared<type[2][2][2][2]>(std::allocator<type>(), 1, 2, 3);
|
||||
BOOST_TEST(type::instances == 16);
|
||||
BOOST_TEST(a1[0][0][0][1].a == 1);
|
||||
BOOST_TEST(a1[0][0][1][0].c == 3);
|
||||
BOOST_TEST(a1[0][1][0][0].f == 0);
|
||||
BOOST_TEST(a1[1][0][0][0].i == 0);
|
||||
}
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
{
|
||||
|
Reference in New Issue
Block a user