forked from boostorg/smart_ptr
Convert function parameter for inner array size into template parameter and make identifiers in array_deleter consistent with those in array_utility
[SVN r81782]
This commit is contained in:
@ -141,7 +141,7 @@ namespace boost {
|
||||
p3 = reinterpret_cast<T3*>(list);
|
||||
p1 = reinterpret_cast<T1*>(p2);
|
||||
d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
|
||||
d2->construct_list(p2, p3, M);
|
||||
d2->construct_list<M>(p2, p3);
|
||||
return boost::shared_ptr<T>(s1, p1);
|
||||
}
|
||||
template<typename T, typename A>
|
||||
@ -165,7 +165,7 @@ namespace boost {
|
||||
p3 = reinterpret_cast<T3*>(list);
|
||||
p1 = reinterpret_cast<T1*>(p2);
|
||||
d2 = get_deleter<boost::detail::array_deleter<T2[N]> >(s1);
|
||||
d2->construct_list(p2, p3, M);
|
||||
d2->construct_list<M>(p2, p3);
|
||||
return boost::shared_ptr<T>(s1, p1);
|
||||
}
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
|
@ -34,13 +34,13 @@ namespace boost {
|
||||
}
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
void construct(T* memory, T&& value) {
|
||||
array_construct_value(memory, size, sp_forward<T>(value));
|
||||
array_construct(memory, size, sp_forward<T>(value));
|
||||
object = memory;
|
||||
}
|
||||
#if defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
template<typename... Args>
|
||||
void construct(T* memory, Args&&... args) {
|
||||
array_construct_args(memory, size, sp_forward<Args>(args)...);
|
||||
array_construct(memory, size, sp_forward<Args>(args)...);
|
||||
object = memory;
|
||||
}
|
||||
#endif
|
||||
@ -49,8 +49,9 @@ namespace boost {
|
||||
array_construct_list(memory, size, list);
|
||||
object = memory;
|
||||
}
|
||||
void construct_list(T* memory, const T* list, std::size_t n) {
|
||||
array_construct_list(memory, size, list, n);
|
||||
template<std::size_t M>
|
||||
void construct_list(T* memory, const T* list) {
|
||||
array_construct_list<T, M>(memory, size, list);
|
||||
object = memory;
|
||||
}
|
||||
void construct_noinit(T* memory) {
|
||||
@ -84,13 +85,13 @@ namespace boost {
|
||||
}
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
void construct(T* memory, T&& value) {
|
||||
array_construct_value(memory, N, sp_forward<T>(value));
|
||||
array_construct(memory, N, sp_forward<T>(value));
|
||||
object = memory;
|
||||
}
|
||||
#if defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
template<typename... Args>
|
||||
void construct(T* memory, Args&&... args) {
|
||||
array_construct_args(memory, N, sp_forward<Args>(args)...);
|
||||
array_construct(memory, N, sp_forward<Args>(args)...);
|
||||
object = memory;
|
||||
}
|
||||
#endif
|
||||
@ -99,8 +100,9 @@ namespace boost {
|
||||
array_construct_list(memory, N, list);
|
||||
object = memory;
|
||||
}
|
||||
void construct_list(T* memory, const T* list, std::size_t n) {
|
||||
array_construct_list(memory, N, list, n);
|
||||
template<std::size_t M>
|
||||
void construct_list(T* memory, const T* list) {
|
||||
array_construct_list<T, M>(memory, N, list);
|
||||
object = memory;
|
||||
}
|
||||
void construct_noinit(T* memory) {
|
||||
|
@ -17,7 +17,6 @@ namespace boost {
|
||||
namespace detail {
|
||||
template<typename T>
|
||||
inline void array_destroy(T*, std::size_t, boost::true_type) {
|
||||
// do nothing
|
||||
}
|
||||
template<typename T>
|
||||
inline void array_destroy(T* memory, std::size_t size, boost::false_type) {
|
||||
@ -56,7 +55,7 @@ namespace boost {
|
||||
}
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
template<typename T>
|
||||
inline void array_construct_value(T* memory, std::size_t size, T&& value) {
|
||||
inline void array_construct(T* memory, std::size_t size, T&& value) {
|
||||
std::size_t i = 0;
|
||||
try {
|
||||
for (; i < size; i++) {
|
||||
@ -70,7 +69,7 @@ namespace boost {
|
||||
}
|
||||
#if defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
template<typename T, typename... Args>
|
||||
inline void array_construct_args(T* memory, std::size_t size, Args&&... args) {
|
||||
inline void array_construct(T* memory, std::size_t size, Args&&... args) {
|
||||
std::size_t i = 0;
|
||||
try {
|
||||
for (; i < size; i++) {
|
||||
@ -97,13 +96,13 @@ namespace boost {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
inline void array_construct_list(T* memory, std::size_t size, const T* list, std::size_t n) {
|
||||
template<typename T, std::size_t N>
|
||||
inline void array_construct_list(T* memory, std::size_t size, const T* list) {
|
||||
std::size_t i = 0;
|
||||
try {
|
||||
for (; i < size; i++) {
|
||||
void* p1 = memory + i;
|
||||
::new(p1) T(list[i % n]);
|
||||
::new(p1) T(list[i % N]);
|
||||
}
|
||||
} catch (...) {
|
||||
array_destroy(memory, i);
|
||||
@ -112,7 +111,6 @@ namespace boost {
|
||||
}
|
||||
template<typename T>
|
||||
inline void array_construct_noinit(T*, std::size_t, boost::true_type) {
|
||||
// do nothing
|
||||
}
|
||||
template<typename T>
|
||||
inline void array_construct_noinit(T* memory, std::size_t size, boost::false_type) {
|
||||
|
@ -140,7 +140,7 @@ namespace boost {
|
||||
p3 = reinterpret_cast<T3*>(list);
|
||||
p1 = reinterpret_cast<T1*>(p2);
|
||||
d2 = get_deleter<boost::detail::array_deleter<T2[]> >(s1);
|
||||
d2->construct_list(p2, p3, M);
|
||||
d2->construct_list<M>(p2, p3);
|
||||
return boost::shared_ptr<T>(s1, p1);
|
||||
}
|
||||
template<typename T>
|
||||
@ -163,7 +163,7 @@ namespace boost {
|
||||
p3 = reinterpret_cast<T3*>(list);
|
||||
p1 = reinterpret_cast<T1*>(p2);
|
||||
d2 = get_deleter<boost::detail::array_deleter<T2[N]> >(s1);
|
||||
d2->construct_list(p2, p3, M);
|
||||
d2->construct_list<M>(p2, p3);
|
||||
return boost::shared_ptr<T>(s1, p1);
|
||||
}
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
|
Reference in New Issue
Block a user