Add assertion to overload of make_shared and allocate_shared for T[N] with initializer lists. Rename detail type to be more intuitive.

[SVN r81267]
This commit is contained in:
Glen Fernandes
2012-11-09 18:01:39 +00:00
parent 2731957b5b
commit 8cc50a5ce9
4 changed files with 26 additions and 16 deletions
@@ -23,7 +23,7 @@ namespace boost {
typedef typename detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
size_t n1 = size * detail::array_size<T1>::size;
size_t n1 = size * detail::array_total<T1>::size;
detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
detail::array_deleter<T2> d1;
shared_ptr<T> s1(p1, d1, a1);
@@ -41,7 +41,7 @@ namespace boost {
typedef typename detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
size_t n1 = size * detail::array_size<T1>::size;
size_t n1 = size * detail::array_total<T1>::size;
detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
detail::array_deleter<T2> d1;
shared_ptr<T> s1(p1, d1, a1);
@@ -58,7 +58,7 @@ namespace boost {
typedef typename detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
size_t n1 = detail::array_size<T>::size;
size_t n1 = detail::array_total<T>::size;
detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
detail::array_deleter<T2> d1;
shared_ptr<T> s1(p1, d1, a1);
@@ -79,7 +79,7 @@ namespace boost {
T1* p1 = 0;
T2* p2 = 0;
T3* p3 = 0;
size_t n1 = list.size() * detail::array_size<T1>::size;
size_t n1 = list.size() * detail::array_total<T1>::size;
detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
detail::array_deleter<T2> d1;
shared_ptr<T> s1(p1, d1, a1);
@@ -93,13 +93,14 @@ namespace boost {
template<typename T, typename A>
inline typename detail::sp_if_size_array<T>::type
allocate_shared(const A& allocator, typename detail::array_list<T>::type list) {
BOOST_ASSERT(list.size() == detail::array_size<T>::size);
typedef typename detail::array_inner<T>::type T1;
typedef typename detail::array_base<T1>::type T2;
typedef const T2 T3;
T1* p1 = 0;
T2* p2 = 0;
T3* p3 = 0;
size_t n1 = detail::array_size<T>::size;
size_t n1 = detail::array_total<T>::size;
detail::allocate_array_helper<A, T2> a1(allocator, n1, &p2);
detail::array_deleter<T2> d1;
shared_ptr<T> s1(p1, d1, a1);