BloombergLP::bslfmt::PadUtil::pad

Write filler to out the specified padWidth times.

Synopsis

Declared in <bslfmt_padutil.h>

template<class t_ITERATOR>
static
t_ITERATOR
pad(
    t_ITERATOR out,
    std::ptrdiff_t padWidth,
    std::string_view const& filler);

Description

Write the specified filler (possibly a multi-byte unicode sequence) to the specified out the specified padWidth times and return the new output iterator. If padWidth < 0, no output is done. The behavior is undefined unless the character type of filler is the same as t_CHAR or filler is entirely ascii. Note that the overloads that input a single character have an advantage over bsl::fill_n in that they will automatically widen or narrow the input character to t_CHAR if necessary.

Return Value

the output iterator after writing the filler repetitions

Parameters

NameDescription
outoutput iterator receiving the filler repetitions
padWidthnumber of times to write filler; no output if < 0
fillercharacter sequence written as each padding unit