...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::type_dispatcher — A type dispatcher interface.
// 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(); };
All type dispatchers support this interface. It is used to acquire the visitor interface for the requested type.
type_dispatcher
public
construct/copy/destructexplicit type_dispatcher(get_callback_impl_type get_callback_impl) noexcept;
Initializing constructor
type_dispatcher(type_dispatcher const & that) = default;
type_dispatcher & operator=(type_dispatcher const & that) = default;
~type_dispatcher();
type_dispatcher
public member functionstemplate<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 |