Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / multiprecision / doc / html / boost_multiprecision / tut / misc / debug_adaptor.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>debug_adaptor</title>
5 <link rel="stylesheet" href="../../../multiprecision.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.Multiprecision">
8 <link rel="up" href="../misc.html" title="Miscellaneous Number Types.">
9 <link rel="prev" href="logged_adaptor.html" title="logged_adaptor">
10 <link rel="next" href="visualizers.html" title="Visual C++ Debugger Visualizers">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="logged_adaptor.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.html"><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="visualizers.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="boost_multiprecision.tut.misc.debug_adaptor"></a><a class="link" href="debug_adaptor.html" title="debug_adaptor">debug_adaptor</a>
28 </h4></div></div></div>
29 <p>
30           <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">debug_adaptor</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
31         </p>
32 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">multiprecision</span><span class="special">{</span>
33
34 <span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">&gt;</span>
35 <span class="keyword">class</span> <span class="identifier">debug_adaptor</span><span class="special">;</span>
36
37 <span class="special">}}</span> <span class="comment">// namespaces</span>
38 </pre>
39 <p>
40           The <code class="computeroutput"><span class="identifier">debug_adaptor</span></code> type
41           is used in conjunction with <code class="computeroutput"><span class="identifier">number</span></code>
42           and some other backend type: it acts as a thin wrapper around some other
43           backend to class <code class="computeroutput"><span class="identifier">number</span></code>
44           and intercepts all operations on that object storing the result as a string
45           within itself.
46         </p>
47 <p>
48           This type provides <code class="computeroutput"><span class="identifier">numeric_limits</span></code>
49           support whenever the template argument Backend does so.
50         </p>
51 <p>
52           This type is particularly useful when your debugger provides a good view
53           of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>: when this is the case multiprecision
54           values can easily be inspected in the debugger by looking at the <code class="computeroutput"><span class="identifier">debug_value</span></code> member of <code class="computeroutput"><span class="identifier">debug_adaptor</span></code>.
55           The down side of this approach is that runtimes are much slower when using
56           this type. Set against that it can make debugging very much easier, certainly
57           much easier than sprinkling code with <code class="computeroutput"><span class="identifier">printf</span></code>
58           statements.
59         </p>
60 <p>
61           When used in conjunction with the Visual C++ debugger visualisers, the
62           value of a multiprecision type that uses this backend is displayed in the
63           debugger just a builtin value would be, here we're inspecting a value of
64           type <code class="computeroutput"><span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">debug_adaptor</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float</span><span class="special">&lt;</span><span class="number">50</span><span class="special">&gt;</span> <span class="special">&gt;</span>
65           <span class="special">&gt;</span></code>:
66         </p>
67 <p>
68           <span class="inlinemediaobject"><img src="../../../../debugger1.png"></span>
69         </p>
70 <p>
71           Otherwise you will need to expand out the view and look at the "debug_value"
72           member:
73         </p>
74 <p>
75           <span class="inlinemediaobject"><img src="../../../../debugger2.png"></span>
76         </p>
77 <p>
78           It works for all the backend types equally too, here it is inspecting a
79           <code class="computeroutput"><span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">debug_adaptor</span><span class="special">&lt;</span><span class="identifier">gmp_rational</span><span class="special">&gt;</span>
80           <span class="special">&gt;</span></code>:
81         </p>
82 <p>
83           <span class="inlinemediaobject"><img src="../../../../debugger3.png"></span>
84         </p>
85 </div>
86 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
87 <td align="left"></td>
88 <td align="right"><div class="copyright-footer">Copyright &#169; 2002-2019 John Maddock
89       and Christopher Kormanyos<p>
90         Distributed under the Boost Software License, Version 1.0. (See accompanying
91         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>)
92       </p>
93 </div></td>
94 </tr></table>
95 <hr>
96 <div class="spirit-nav">
97 <a accesskey="p" href="logged_adaptor.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../misc.html"><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="visualizers.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
98 </div>
99 </body>
100 </html>