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 template function

boost::log::attributes::function — A class of an attribute that acquires its value from a third-party function object.

Synopsis

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

template<typename R> 
class function : public attribute {
public:
  // types
  typedef R value_type;  // The attribute value type. 

  // member classes/structs/unions

  // Base class for factory implementation.

  class impl : public attribute::impl {
  };

  // Factory implementation.
  template<typename T> 
  class impl_template : public function< R >::impl {
  public:
    // construct/copy/destruct
    explicit impl_template(T const &);

    // public member functions
    virtual attribute_value get_value();
  };

  // construct/copy/destruct
  template<typename T> explicit function(T const &);
  explicit function(cast_source const &);

  // private member functions
   BOOST_STATIC_ASSERT_MSG(!is_void< R >::value, 
                           "Boost.Log: Function object return type must not be void");
};

Description

The attribute calls a stored nullary function object to acquire each value. The result type of the function object is the attribute value type.

It is not recommended to use this class directly. Use make_function convenience functions to construct the attribute instead.

function public construct/copy/destruct

  1. template<typename T> explicit function(T const & fun);

    Initializing constructor

  2. explicit function(cast_source const & source);

    Constructor for casting support

function private member functions

  1.  BOOST_STATIC_ASSERT_MSG(!is_void< R >::value, 
                             "Boost.Log: Function object return type must not be void");

PrevUpHomeNext