|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81782 - in trunk/boost/smart_ptr: . detail
From: glenfe_at_[hidden]
Date: 2012-12-08 00:25:57
Author: glenfe
Date: 2012-12-08 00:25:50 EST (Sat, 08 Dec 2012)
New Revision: 81782
URL: http://svn.boost.org/trac/boost/changeset/81782
Log:
Convert function parameter for inner array size into template parameter and make identifiers in array_deleter consistent with those in array_utility
Text files modified:
trunk/boost/smart_ptr/allocate_shared_array.hpp | 4 ++--
trunk/boost/smart_ptr/detail/array_deleter.hpp | 18 ++++++++++--------
trunk/boost/smart_ptr/detail/array_utility.hpp | 12 +++++-------
trunk/boost/smart_ptr/make_shared_array.hpp | 4 ++--
4 files changed, 19 insertions(+), 19 deletions(-)
Modified: trunk/boost/smart_ptr/allocate_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/allocate_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/allocate_shared_array.hpp 2012-12-08 00:25:50 EST (Sat, 08 Dec 2012)
@@ -141,7 +141,7 @@
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 @@
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)
Modified: trunk/boost/smart_ptr/detail/array_deleter.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/array_deleter.hpp (original)
+++ trunk/boost/smart_ptr/detail/array_deleter.hpp 2012-12-08 00:25:50 EST (Sat, 08 Dec 2012)
@@ -34,13 +34,13 @@
}
#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 @@
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 @@
}
#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 @@
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) {
Modified: trunk/boost/smart_ptr/detail/array_utility.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/array_utility.hpp (original)
+++ trunk/boost/smart_ptr/detail/array_utility.hpp 2012-12-08 00:25:50 EST (Sat, 08 Dec 2012)
@@ -17,7 +17,6 @@
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 @@
}
#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 @@
}
#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 @@
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 @@
}
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) {
Modified: trunk/boost/smart_ptr/make_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/make_shared_array.hpp 2012-12-08 00:25:50 EST (Sat, 08 Dec 2012)
@@ -140,7 +140,7 @@
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 @@
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)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk