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 type_dispatcher

boost::log::type_dispatcher — A type dispatcher interface.


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

class type_dispatcher {
  // member classes/structs/unions
  template<typename T> 
  class callback {

    // public member functions
    void operator()(T const &) const;
    explicit operator bool() const noexcept;
    bool operator!() const noexcept;
  // construct/copy/destruct
  explicit type_dispatcher(get_callback_impl_type) noexcept;
  type_dispatcher(type_dispatcher const &) = default;
  type_dispatcher & operator=(type_dispatcher const &) = default;

  // public member functions
  template<typename T> callback< T > get_callback();


All type dispatchers support this interface. It is used to acquire the visitor interface for the requested type.

type_dispatcher public construct/copy/destruct

  1. explicit type_dispatcher(get_callback_impl_type get_callback_impl) noexcept;

    Initializing constructor

  2. type_dispatcher(type_dispatcher const & that) = default;
  3. type_dispatcher & operator=(type_dispatcher const & that) = default;
  4. ~type_dispatcher();

type_dispatcher public member functions

  1. template<typename T> callback< T > get_callback();

    The method requests a callback for the value of type T


    The type-specific callback or an empty value, if the type is not supported