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

PrevUpHomeNext

Class template constant

boost::log::attributes::constant — A class of an attribute that holds a single constant value.

Synopsis

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

template<typename T> 
class constant : public attribute {
public:
  // types
  typedef T value_type;  // Attribute value type. 

  // member classes/structs/unions

  // Factory implementation.

  class impl : public attribute_value_impl< value_type > {
  public:

    // public member functions
    explicit impl(value_type const &);
    explicit impl(value_type &&) noexcept(boost::is_nothrow_move_constructible< value_type >::value);
  };

  // public member functions
  explicit constant(value_type const &);
  explicit constant(value_type &&);
  explicit constant(cast_source const &);
  value_type const & get() const;
};

Description

The constant is a simplest and one of the most frequently used types of attributes. It stores a constant value, which it eventually returns as its value each time requested.

constant public member functions

  1. explicit constant(value_type const & value);

    Constructor with the stored value initialization

  2. explicit constant(value_type && value);

    Constructor with the stored value initialization

  3. explicit constant(cast_source const & source);

    Constructor for casting support

  4. value_type const & get() const;

    Returns:

    Reference to the contained value.


PrevUpHomeNext