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 attribute_value_impl

boost::log::attributes::attribute_value_impl — Basic attribute value implementation class.


// In header: <boost/log/attributes/attribute_value_impl.hpp>

template<typename T> 
class attribute_value_impl : public attribute_value::impl {
  // types
  typedef T value_type;  // Value type. 

  // construct/copy/destruct
  explicit attribute_value_impl(value_type const &);
  explicit attribute_value_impl(value_type &&) noexcept(boost::is_nothrow_move_constructible< value_type >::value);

  // public member functions
  virtual bool dispatch(type_dispatcher &);
  virtual typeindex::type_index get_type() const;
  value_type const & get() const;


This class can be used as a boilerplate for simple attribute values. The class implements all needed interfaces of attribute values and allows to store a single value of the type specified as a template parameter. The stored value can be dispatched with type dispatching mechanism.

attribute_value_impl public construct/copy/destruct

  1. explicit attribute_value_impl(value_type const & v);

    Constructor with initialization of the stored value

  2. explicit attribute_value_impl(value_type && v) noexcept(boost::is_nothrow_move_constructible< value_type >::value);

    Constructor with initialization of the stored value

attribute_value_impl public member functions

  1. virtual bool dispatch(type_dispatcher & dispatcher);

    Attribute value dispatching method.



    The dispatcher that receives the stored value


    true if the value has been dispatched, false otherwise

  2. virtual typeindex::type_index get_type() const;


    The attribute value type

  3. value_type const & get() const;


    Reference to the contained value.