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

Struct template fallback_to_default

boost::log::fallback_to_default

Synopsis

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

template<typename DefaultT> 
struct fallback_to_default {
  // types
  typedef remove_cv< typenameremove_reference< DefaultT >::type >::type default_type;  // Default value type. 

  enum { guaranteed_result = true };

  // public member functions
  fallback_to_default();
  explicit fallback_to_default(default_type const &);
  template<typename FunT> bool apply_default(FunT &) const;
  template<typename FunT> bool apply_default(FunT const &) const;

  // public static functions
  static void on_invalid_type(typeindex::type_index const &);
  static void on_missing_value();
};

Description

The fallback_to_default policy results in a default value if the attribute value cannot be extracted.

fallback_to_default public member functions

  1. fallback_to_default();

    Default constructor.

  2. explicit fallback_to_default(default_type const & def_val);

    Initializing constructor.

  3. template<typename FunT> bool apply_default(FunT & fun) const;

    The method is called in order to apply a function object to the default value.

  4. template<typename FunT> bool apply_default(FunT const & fun) const;

    The method is called in order to apply a function object to the default value.

fallback_to_default public static functions

  1. static void on_invalid_type(typeindex::type_index const &);

    The method is called when value extraction failed because the attribute value has different type than requested.

  2. static void on_missing_value();

    The method is called when value extraction failed because the attribute value was not found.


PrevUpHomeNext