Function cat

Synopsis

#include <src/c4/format.hpp>

template <class Arg, class... Args>
size_t cat(substr buf, Arg const &C4_RESTRICT a, Args const &C4_RESTRICT ...more)

Description

serialize the arguments, concatenating them to the given fixed-size buffer. The buffer size is strictly respected: no writes will occur beyond its end.

Returns
the number of characters needed to write all the arguments into the buffer.
See
c4::catrs() if instead of a fixed-size buffer, a resizeable container is desired
See
c4::uncat() for the inverse function
See
c4::catsep() if a separator between each argument is to be used
See
c4::format() if a format string is desired

Mentioned in

Source

Lines 448-455 in src/c4/format.hpp.

template<class Arg, class... Args>
size_t cat(substr buf, Arg const& C4_RESTRICT a, Args const& C4_RESTRICT ...more)
{
    size_t num = to_chars(buf, a);
    buf  = buf.len >= num ? buf.sub(num) : substr{};
    num += cat(buf, more...);
    return num;
}





Add Discussion as Guest

Log in