diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 407c103..9d31312 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -93,13 +93,16 @@ struct sp_array_scalar { template struct sp_array_count { - BOOST_STATIC_CONSTEXPR std::size_t value = 1; + enum { + value = 1 + }; }; template struct sp_array_count { - BOOST_STATIC_CONSTEXPR std::size_t value = N * - sp_array_count::value; + enum { + value = N * sp_array_count::value + }; }; template @@ -122,7 +125,9 @@ struct sp_array_storage { template struct sp_max_size { - BOOST_STATIC_CONSTEXPR std::size_t value = N < M ? M : N; + enum { + value = N < M ? M : N + }; }; #if !defined(BOOST_NO_CXX11_ALLOCATOR) @@ -138,12 +143,12 @@ struct sp_bind_allocator { }; #endif -template +template struct sp_enable { }; -template<> -struct sp_enable { - typedef void type; +template +struct sp_enable { + typedef T type; }; template @@ -344,6 +349,14 @@ sp_array_default(T* storage, std::size_t size) } #endif +template +struct sp_less_align { + enum { + value = (boost::alignment_of::value < + boost::alignment_of::value) + }; +}; + template BOOST_CONSTEXPR inline std::size_t sp_objects(std::size_t size) BOOST_NOEXCEPT @@ -352,12 +365,21 @@ sp_objects(std::size_t size) BOOST_NOEXCEPT } template -BOOST_CONSTEXPR inline std::size_t +BOOST_CONSTEXPR inline +typename sp_enable::value, std::size_t>::type sp_align(std::size_t size) BOOST_NOEXCEPT { return (sizeof(T) * size + sizeof(U) - 1) & ~(sizeof(U) - 1); } +template +BOOST_CONSTEXPR inline +typename sp_enable::value, std::size_t>::type +sp_align(std::size_t size) BOOST_NOEXCEPT +{ + return sizeof(T) * size; +} + template class sp_size_array_deleter { public: