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:
    // construct/copy/destruct
    explicit impl(value_type const &);
    explicit impl(value_type &&) noexcept(boost::is_nothrow_move_constructible< value_type >::value);
  };

  // construct/copy/destruct
  explicit constant(value_type const &);
  explicit constant(value_type &&);
  explicit constant(cast_source const &);

  // public member functions
  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 construct/copy/destruct

  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

constant public member functions

  1. value_type const & get() const;

    Returns:

    Reference to the contained value.


PrevUpHomeNext