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 for the latest Boost documentation.
PrevUpHomeNext

Class type_dispatcher

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

Synopsis

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


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

    // 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;
  ~type_dispatcher();

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

Description

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

    Returns:

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


PrevUpHomeNext