Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

sequence

Makes a range formattable by supplying a per-element formatter function.

Synopsis

Defined in header <boost/mysql/format_sql.hpp>

template<
    class Range,
    class FormatFn>
auto
sequence(
    Range&& range,
    FormatFn fn,
    constant_string_view glue = ", ");
Description

Objects returned by this function satisfy Formattable. When formatted, the formatter function fn is invoked for each element in the range. The glue string glue is output raw (as per format_context_base::append_raw) between consecutive invocations of the formatter function, generating an effect similar to std::ranges::views::join.

Type requirements
Object lifetimes

The input range is stored in format_sequence_view as a view, using an iterator/sentinel pair, and is never copied. The caller must make sure that the elements pointed by the obtained iterator/sentinel are kept alive until the view is formatted.

Exception safety

Strong-throw guarantee. Throws any exception that std::begin, std::end or move-constructing FormatFn may throw.


PrevUpHomeNext