forked from boostorg/smart_ptr
Do not rely on size of type_with_alignment
This commit is contained in:
@ -367,12 +367,22 @@ sp_objects(std::size_t size) BOOST_NOEXCEPT
|
|||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
BOOST_CONSTEXPR inline
|
BOOST_CONSTEXPR inline
|
||||||
typename sp_enable<sp_less_align<T, U>::value, std::size_t>::type
|
typename sp_enable<sp_less_align<T, U>::value &&
|
||||||
sp_align(std::size_t size) BOOST_NOEXCEPT
|
(sizeof(U) % 2 == 0), std::size_t>::type
|
||||||
|
sp_align(std::size_t size) BOOST_NOEXCEPT_OR_NOTHROW
|
||||||
{
|
{
|
||||||
return (sizeof(T) * size + sizeof(U) - 1) & ~(sizeof(U) - 1);
|
return (sizeof(T) * size + sizeof(U) - 1) & ~(sizeof(U) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class U>
|
||||||
|
BOOST_CONSTEXPR inline
|
||||||
|
typename sp_enable<sp_less_align<T, U>::value &&
|
||||||
|
(sizeof(U) % 2 != 0), std::size_t>::type
|
||||||
|
sp_align(std::size_t size) BOOST_NOEXCEPT_OR_NOTHROW
|
||||||
|
{
|
||||||
|
return (sizeof(T) * size + sizeof(U) - 1) / sizeof(U) * sizeof(U);
|
||||||
|
}
|
||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
BOOST_CONSTEXPR inline
|
BOOST_CONSTEXPR inline
|
||||||
typename sp_enable<!sp_less_align<T, U>::value, std::size_t>::type
|
typename sp_enable<!sp_less_align<T, U>::value, std::size_t>::type
|
||||||
|
Reference in New Issue
Block a user