12#include "comms/details/tag.h"
33 static std::size_t maxSizeOf(
const T& val)
35 using DecayedType =
typename std::decay<
decltype(val)>::type;
37 typename comms::util::LazyShallowConditional<
38 comms::util::detect::hasMaxSizeFunc<DecayedType>()
44 return maxSizeOfInternal(val, Tag());
48 template <
typename... TParams>
49 using HasMaxSizeTag = comms::details::tag::Tag1<>;
51 template <
typename... TParams>
52 using NoMaxSizeTag = comms::details::tag::Tag2<>;
54 template <
typename T,
typename... TParams>
55 static std::size_t maxSizeOfInternal(
const T& val, HasMaxSizeTag<>)
57 return val.max_size();
60 template <
typename T,
typename... TParams>
61 static std::size_t maxSizeOfInternal(
const T& val, NoMaxSizeTag<>)
63 static_cast<void>(val);
64 return std::numeric_limits<std::size_t>::max();
72std::size_t maxSizeOf(
const T& val)
74 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.