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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

formatter

(EXPERIMENTAL) An extension point to customize SQL formatting.

Synopsis

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

template<
    class T>
struct formatter
Description

This type can be specialized for custom types to make them formattable. This makes them satisfy the Formattable concept, and usable in format_sql and format_context_base::append_value.

A formatter specialization for a type T should have the following form:

template <> struct formatter<MyType> {
    static void format( const MyType&, format_context_base&);
}

Don't specialize formatter for built-in types, like int, std::string or optionals (formally, any type satisfying WritableField). This is not supported and will result in a compile-time error.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext