Boost C++ Libraries 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.

Class template basic_formatter



// In header: <boost/log/expressions/formatter.hpp>

template<typename CharT> 
class basic_formatter {
  // types
  typedef void                                  result_type;  // Result type. 
  typedef CharT                                 char_type;    // Character type. 
  typedef basic_formatting_ostream< char_type > stream_type;  // Output stream type. 

  // construct/copy/destruct
  basic_formatter(basic_formatter const &);
  basic_formatter(this_type &&) noexcept;
  template<typename FunT> basic_formatter(FunT &&);
  basic_formatter & operator=(this_type &&) noexcept;
  basic_formatter & operator=(this_type const &);
  template<typename FunT> basic_formatter & operator=(FunT &&);

  // public member functions
  result_type operator()(record_view const &, stream_type &) const;
  void reset();
  void swap(basic_formatter &) noexcept;


Log record formatter function wrapper.

basic_formatter public construct/copy/destruct

  1. basic_formatter();

    Default constructor. Creates a formatter that only outputs log message.

  2. basic_formatter(basic_formatter const & that);

    Copy constructor

  3. basic_formatter(this_type && that) noexcept;

    Move constructor. The moved-from formatter is left in an unspecified state.

  4. template<typename FunT> basic_formatter(FunT && fun);

    Initializing constructor. Creates a formatter which will invoke the specified function object.

  5. basic_formatter & operator=(this_type && that) noexcept;

    Move assignment. The moved-from formatter is left in an unspecified state.

  6. basic_formatter & operator=(this_type const & that);

    Copy assignment.

  7. template<typename FunT> basic_formatter & operator=(FunT && fun);

    Initializing assignment. Sets the specified function object to the formatter.

basic_formatter public member functions

  1. result_type operator()(record_view const & rec, stream_type & strm) const;

    Formatting operator.



    A log record to format.


    A stream to put the formatted characters to.

  2. void reset();

    Resets the formatter to the default. The default formatter only outputs message text.

  3. void swap(basic_formatter & that) noexcept;

    Swaps two formatters