folly::require_sizeof

require_sizeof

Synopsis

Declared in <folly/Traits.h>

template<typename T>
constexpr std::size_t require_sizeof = detail::require_sizeof_<void, T>::size;

Description

Equivalent to sizeof, but with a static_assert enforcing that application of sizeof would not fail substitution.

Application of sizeof fails on the following kinds of types: * function types. * incomplete types, including possibly-cv-qualified void * references to types to which application of sizeof would fail