...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::fallback_to_default
// 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(); };
The fallback_to_default
policy results in a default value if the attribute value cannot be extracted.