folly::estimateSpaceNeeded

Fallback estimate of the space needed for an arbitrary value.

Synopsis

Declared in <folly/Conv.h>

template<class Src>
constexpr
size_t
estimateSpaceNeeded(Src const& value)
requires !std::is_fundamental<Src>::value &&
#if FOLLY_HAVE_INT128_T
        // On OSX 10.10, is_fundamental<__int128> is false :-O
        !std::is_same<__int128, Src>::value &&
        !std::is_same<unsigned __int128, Src>::value &&
#endif
        !IsSomeString<Src>::value &&
        !std::is_convertible<Src, const char*>::value &&
        !std::is_convertible<Src, StringPiece>::value &&
        !std::is_enum<Src>::value;

Return Value

The estimated number of characters.

Parameters

NameDescription
valueThe value whose string length is estimated.