Use const T (&)[N] for fixed size arrays instead of std::initializer<T> in overloads of make_shared and allocate_shared for arrays.

[SVN r81641]
This commit is contained in:
Glen Fernandes
2012-12-01 04:36:41 +00:00
parent 39ff002d2e
commit 4da0e2b7fc
6 changed files with 78 additions and 44 deletions

View File

@@ -12,6 +12,20 @@
int main() {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
{
boost::shared_ptr<int[]> a1 = boost::make_shared<int[]>({0, 1, 2, 3});
BOOST_TEST(a1[0] == 0);
BOOST_TEST(a1[1] == 1);
BOOST_TEST(a1[2] == 2);
BOOST_TEST(a1[3] == 3);
}
{
boost::shared_ptr<int[4]> a1 = boost::make_shared<int[4]>({0, 1, 2, 3});
BOOST_TEST(a1[0] == 0);
BOOST_TEST(a1[1] == 1);
BOOST_TEST(a1[2] == 2);
BOOST_TEST(a1[3] == 3);
}
{
boost::shared_ptr<int[][2]> a1 = boost::make_shared<int[][2]>({ {0, 1}, {2, 3} });
BOOST_TEST(a1[0][0] == 0);