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


Class template static_type_dispatcher

boost::log::static_type_dispatcher — A static type dispatcher class.


// In header: <boost/log/utility/type_dispatch/static_type_dispatcher.hpp>

template<typename T> 
class static_type_dispatcher {
  // construct/copy/destruct
  template<typename ReceiverT> explicit static_type_dispatcher(ReceiverT &);
  static_type_dispatcher(static_type_dispatcher const &) = delete;
  static_type_dispatcher & operator=(static_type_dispatcher const &) = delete;


The type dispatcher can be used to pass objects of arbitrary types from one component to another. With regard to the library, the type dispatcher can be used to extract attribute values.

Static type dispatchers allow to specify one or several supported types at compile time.

static_type_dispatcher public construct/copy/destruct

  1. template<typename ReceiverT> 
      explicit static_type_dispatcher(ReceiverT & receiver);

    Constructor. Initializes the dispatcher internals.

    The receiver object is not copied inside the dispatcher, but references to it may be kept by the dispatcher after construction. The receiver object must remain valid until the dispatcher is destroyed.



    Unary function object that will be called on a dispatched value. The receiver must be callable with an argument of any of the supported types of the dispatcher.

  2. static_type_dispatcher(static_type_dispatcher const &) = delete;
  3. static_type_dispatcher & operator=(static_type_dispatcher const &) = delete;