9 template<
typename T>
inline const T& deref_maybe(
const T&
object)
13 template<
typename T>
inline const T& deref_maybe(T*
object)
17 template<
typename T>
inline const T& deref_maybe(
const std::shared_ptr<T>&
object)
21 template<
typename T>
inline const T& deref_maybe(
const std::unique_ptr<T>&
object)
28 template<
typename T>
template<
typename V>
size_t Size<T>::operator()(
const V&
object)
const
30 return detail::deref_maybe(
object).size();
33 template<
typename T>
template<
typename V>
size_t SizeOf<T>::operator()(
const V& )
const
38 template<
typename T>
template<
typename V>
size_t CapacityDynamicallyAllocated<T>::operator()(
const V&
object)
const
40 size_t capacity = detail::deref_maybe(
object).capacity();
41 if (capacity < 1024) {
42 capacity = std::max(
static_cast<size_t>(16), round_up(capacity));
48 template<
typename T>
size_t CapacityDynamicallyAllocated<T>::round_up(
const size_t value)
const
50 return ((value +
sizeof(
void*) - 1) /
sizeof(
void*)) *
sizeof(
void*);