1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Struct fallback_to_none</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Log v2"> 8<link rel="up" href="../../attributes.html#header.boost.log.attributes.fallback_policy_hpp" title="Header <boost/log/attributes/fallback_policy.hpp>"> 9<link rel="prev" href="attributes/current_thread_id/impl.html" title="Class impl"> 10<link rel="next" href="fallback_to_throw.html" title="Struct fallback_to_throw"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td></tr></table> 14<hr> 15<div class="spirit-nav"> 16<a accesskey="p" href="attributes/current_thread_id/impl.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.fallback_policy_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fallback_to_throw.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 17</div> 18<div class="refentry"> 19<a name="boost.log.fallback_to_none"></a><div class="titlepage"></div> 20<div class="refnamediv"> 21<h2><span class="refentrytitle">Struct fallback_to_none</span></h2> 22<p>boost::log::fallback_to_none</p> 23</div> 24<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 25<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../attributes.html#header.boost.log.attributes.fallback_policy_hpp" title="Header <boost/log/attributes/fallback_policy.hpp>">boost/log/attributes/fallback_policy.hpp</a>> 26 27</span> 28<span class="keyword">struct</span> <a class="link" href="fallback_to_none.html" title="Struct fallback_to_none">fallback_to_none</a> <span class="special">{</span> 29 30 <span class="keyword">enum</span> <a name="boost.log.fallback_to_none.@0"></a>@0 <span class="special">{</span> guaranteed_result = = false <span class="special">}</span><span class="special">;</span> 31 32 <span class="comment">// <a class="link" href="fallback_to_none.html#idm46079579373984-bb">public static functions</a></span> 33 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FunT<span class="special">></span> <span class="keyword">static</span> <span class="keyword">bool</span> <a class="link" href="fallback_to_none.html#idm46079579373424-bb"><span class="identifier">apply_default</span></a><span class="special">(</span><span class="identifier">FunT</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span> 34 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FunT<span class="special">></span> <span class="keyword">static</span> <span class="keyword">bool</span> <a class="link" href="fallback_to_none.html#idm46079579370288-bb"><span class="identifier">apply_default</span></a><span class="special">(</span><span class="identifier">FunT</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span> 35 <span class="keyword">static</span> <span class="keyword">void</span> <a class="link" href="fallback_to_none.html#idm46079579367152-bb"><span class="identifier">on_invalid_type</span></a><span class="special">(</span><span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_index</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span> 36 <span class="keyword">static</span> <span class="keyword">void</span> <a class="link" href="fallback_to_none.html#idm46079579364816-bb"><span class="identifier">on_missing_value</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span> 37<span class="special">}</span><span class="special">;</span></pre></div> 38<div class="refsect1"> 39<a name="idm44984883106016"></a><h2>Description</h2> 40<p>The <code class="computeroutput"><a class="link" href="fallback_to_none.html" title="Struct fallback_to_none">fallback_to_none</a></code> policy results in returning an empty value reference if the attribute value cannot be extracted. </p> 41<div class="refsect2"> 42<a name="idm44984883103920"></a><h3> 43<a name="idm46079579373984-bb"></a><code class="computeroutput">fallback_to_none</code> public static functions</h3> 44<div class="orderedlist"><ol class="orderedlist" type="1"> 45<li class="listitem"> 46<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FunT<span class="special">></span> <span class="keyword">static</span> <span class="keyword">bool</span> <a name="idm46079579373424-bb"></a><span class="identifier">apply_default</span><span class="special">(</span><span class="identifier">FunT</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span></pre> 47<p>The method is called in order to apply a function object to the default value. </p> 48</li> 49<li class="listitem"> 50<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> FunT<span class="special">></span> <span class="keyword">static</span> <span class="keyword">bool</span> <a name="idm46079579370288-bb"></a><span class="identifier">apply_default</span><span class="special">(</span><span class="identifier">FunT</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span></pre> 51<p>The method is called in order to apply a function object to the default value. </p> 52</li> 53<li class="listitem"> 54<pre class="literallayout"><span class="keyword">static</span> <span class="keyword">void</span> <a name="idm46079579367152-bb"></a><span class="identifier">on_invalid_type</span><span class="special">(</span><span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_index</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span></pre> 55<p>The method is called when value extraction failed because the attribute value has different type than requested. </p> 56</li> 57<li class="listitem"> 58<pre class="literallayout"><span class="keyword">static</span> <span class="keyword">void</span> <a name="idm46079579364816-bb"></a><span class="identifier">on_missing_value</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre> 59<p>The method is called when value extraction failed because the attribute value was not found. </p> 60</li> 61</ol></div> 62</div> 63</div> 64</div> 65<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 66<td align="left"></td> 67<td align="right"><div class="copyright-footer">Copyright © 2007-2019 Andrey Semashev<p> 68 Distributed under the Boost Software License, Version 1.0. (See accompanying 69 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>). 70 </p> 71</div></td> 72</tr></table> 73<hr> 74<div class="spirit-nav"> 75<a accesskey="p" href="attributes/current_thread_id/impl.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.fallback_policy_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fallback_to_throw.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 76</div> 77</body> 78</html> 79