Imported Upstream version 1.71.0
[platform/upstream/boost.git] / libs / log / doc / html / boost / log / extract__idm45185966753744.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Function template extract_or_default</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&#160;1.&#160;Boost.Log v2">
8 <link rel="up" href="../../attributes.html#header.boost.log.attributes.value_extraction_hpp" title="Header &lt;boost/log/attributes/value_extraction.hpp&gt;">
9 <link rel="prev" href="extract__idm45185966763104.html" title="Function template extract_or_default">
10 <link rel="next" href="extract_idm45185966745600.html" title="Function template extract">
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="extract__idm45185966763104.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.value_extraction_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="extract_idm45185966745600.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
17 </div>
18 <div class="refentry">
19 <a name="boost.log.extract__idm45185966753744"></a><div class="titlepage"></div>
20 <div class="refnamediv">
21 <h2><span class="refentrytitle">Function template extract_or_default</span></h2>
22 <p>boost::log::extract_or_default</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: &lt;<a class="link" href="../../attributes.html#header.boost.log.attributes.value_extraction_hpp" title="Header &lt;boost/log/attributes/value_extraction.hpp&gt;">boost/log/attributes/value_extraction.hpp</a>&gt;
26
27 </span>
28 <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">,</span> <span class="keyword">typename</span> DefaultT<span class="special">&gt;</span> 
29   <a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">DefaultT</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
30   <span class="identifier">extract_or_default</span><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="keyword">const</span> <span class="special">&amp;</span> value<span class="special">,</span> <span class="identifier">DefaultT</span> <span class="keyword">const</span> <span class="special">&amp;</span> def_val<span class="special">)</span><span class="special">;</span></pre></div>
31 <div class="refsect1">
32 <a name="idm46436917955808"></a><h2>Description</h2>
33 <p>The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited.</p>
34 <div class="note"><table border="0" summary="Note">
35 <tr>
36 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
37 <th align="left">Note</th>
38 </tr>
39 <tr><td align="left" valign="top"><p>Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling.</p></td></tr>
40 </table></div>
41 <p>
42
43
44 </p>
45 <div class="variablelist"><table border="0" class="variablelist compact">
46 <colgroup>
47 <col align="left" valign="top">
48 <col>
49 </colgroup>
50 <tbody>
51 <tr>
52 <td><p><span class="term">Parameters:</span></p></td>
53 <td><div class="variablelist"><table border="0" class="variablelist compact">
54 <colgroup>
55 <col align="left" valign="top">
56 <col>
57 </colgroup>
58 <tbody>
59 <tr>
60 <td><p><span class="term"><code class="computeroutput">def_val</code></span></p></td>
61 <td><p>The default value </p></td>
62 </tr>
63 <tr>
64 <td><p><span class="term"><code class="computeroutput">value</code></span></p></td>
65 <td><p>Attribute value. </p></td>
66 </tr>
67 </tbody>
68 </table></div></td>
69 </tr>
70 <tr>
71 <td><p><span class="term">Returns:</span></p></td>
72 <td><p>The extracted value, if found. The default value otherwise. </p></td>
73 </tr>
74 </tbody>
75 </table></div>
76 </div>
77 </div>
78 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
79 <td align="left"></td>
80 <td align="right"><div class="copyright-footer">Copyright &#169; 2007-2016 Andrey Semashev<p>
81         Distributed under the Boost Software License, Version 1.0. (See accompanying
82         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>).
83       </p>
84 </div></td>
85 </tr></table>
86 <hr>
87 <div class="spirit-nav">
88 <a accesskey="p" href="extract__idm45185966763104.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.value_extraction_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="extract_idm45185966745600.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
89 </div>
90 </body>
91 </html>