folly::estimateSpaceNeeded

estimateSpaceNeeded overloads

Synopses

Declared in <folly/Conv.h>

Estimate the space needed for a value convertible to const char*.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires std::is_convertible<Src, const char*>::value;
» more...

Estimate the space needed for a value convertible to StringPiece.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires std::is_convertible<Src, folly::StringPiece>::value &&
        !IsSomeString<Src>::value &&
        !std::is_convertible<Src, const char*>::value;
» more...

Estimate the space needed for a pointer to a string-like value.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires std::is_pointer<Src>::value &&
        IsSomeString<std::remove_pointer<Src>>::value;
» more...

Estimate the space needed to append a signed 32/64-bit integer.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires is_integral_v<Src> && is_signed_v<Src> && sizeof(Src) >= 4 &&
        sizeof(Src) < 16;
» more...

Estimate the space needed to append an unsigned 32/64-bit integer.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires is_integral_v<Src> && !is_signed_v<Src> && sizeof(Src) >= 4 &&
        sizeof(Src) < 16;
» more...

Estimate the space needed to append a small integer.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires is_integral_v<Src> && sizeof(Src) < 4 && !std::is_same<Src, char>::value;
» more...

Estimate the space needed to append an enumerated value.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires std::is_enum<Src>::value;
» more...

Upper bound of the length of fmt's shortest representation of any IEEE-754 double: 17-digit mantissa + decimal point + sign + "e-308" = 24, plus one for a negative sign on the value itself.

template<class Src>
size_t
estimateSpaceNeeded(Src value)
requires std::is_floating_point<Src>::value;
» more...

overloadbrief Estimates the number of characters in a value's string representation.

template<class T>
constexpr
size_t
estimateSpaceNeeded(T value)
requires std::is_same<T, char>::value;
» more...

Estimate the space needed to append a 128-bit signed integer.

template<class T>
constexpr
size_t
estimateSpaceNeeded(T value)
requires std::is_same<T, __int128>::value;
» more...

Estimate the space needed to append a 128-bit unsigned integer.

template<class T>
constexpr
size_t
estimateSpaceNeeded(T value)
requires std::is_same<T, unsigned __int128>::value;
» more...

Estimate the space needed for a string-like value.

template<class Src>
size_t
estimateSpaceNeeded(Src const& value)
requires IsSomeString<Src>::value;
» more...

Fallback estimate of the space needed for an arbitrary value.

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;
» more...

Estimate the space needed to append a string literal.

template<size_t N>
constexpr
size_t
estimateSpaceNeeded(char const(& value)[]);
» more...
template<>
size_t
estimateSpaceNeeded<std::nullptr_t>(std::nullptr_t);
» more...

Return Value

The estimated number of characters.

Parameters

NameDescription
valueThe value whose string length is estimated.