![]() |
Home | Libraries | People | FAQ | More |
Makes a range formattable by supplying a per-element formatter function.
Defined in header <boost/mysql/format_sql.hpp>
template< class Range, class FormatFn> auto sequence( Range&& range, FormatFn fn, constant_string_view glue = ", ");
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.
std::begin(range)
and std::end(range)
should return an input iterator/sentinel pair that can be compared for
(in)equality.
static_cast<const FormatFn&>(fn)(*stdbegin(range), ctx)
should be well formed, with ctx
begin a format_context_base&.
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.
Strong-throw guarantee. Throws any exception that std::begin,
std::end or move-constructing FormatFn may throw.