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 a snapshot of the develop branch, built from commit 43d731810b.
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 @2 { guaranteed_result = = true };

  // construct/copy/destruct
  fallback_to_default();
  explicit fallback_to_default(default_type const &);

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

  1. fallback_to_default();

    Default constructor.

  2. explicit fallback_to_default(default_type const & def_val);

    Initializing constructor.

fallback_to_default public member functions

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

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

  2. 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