14#include "comms/details/tag.h"
31 static std::size_t maxSizeOf(
const T& val)
33 using DecayedType =
typename std::decay<
decltype(val)>::type;
35 typename comms::util::LazyShallowConditional<
36 comms::util::detect::hasMaxSizeFunc<DecayedType>()
42 return maxSizeOfInternal(val, Tag());
46 template <
typename... TParams>
47 using HasMaxSizeTag = comms::details::tag::Tag1<>;
49 template <
typename... TParams>
50 using NoMaxSizeTag = comms::details::tag::Tag2<>;
52 template <
typename T,
typename... TParams>
53 static std::size_t maxSizeOfInternal(
const T& val, HasMaxSizeTag<>)
55 return val.max_size();
58 template <
typename T,
typename... TParams>
59 static std::size_t maxSizeOfInternal(
const T& val, NoMaxSizeTag<>)
61 static_cast<void>(val);
62 return std::numeric_limits<std::size_t>::max();
70std::size_t maxSizeOf(
const T& val)
72 return details::MaxSizeOfHelper::maxSizeOf(val);
Main namespace for all classes / functions of COMMS library.
Replacement to some types from standard type_traits.
Various compile-time detection functions of whether specific member functions and/or types exist.