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 an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

debug_adaptor

#include <boost/multiprecision/debug_adaptor.hpp>

namespace boost{ namespace multiprecision{

template <Backend>
class debug_adaptor;

template <class Number>
using debug_adaptor_t = number<debug_adaptor<typename Number::backend_type>, Number::et>

}} // namespaces

The debug_adaptor type is used in conjunction with number and some other backend type: it acts as a thin wrapper around some other backend to class number and intercepts all operations on that object storing the result as a string within itself.

This type provides numeric_limits support whenever the template argument Backend does so.

This type is particularly useful when your debugger provides a good view of std::string: when this is the case multiprecision values can easily be inspected in the debugger by looking at the debug_value member of debug_adaptor. The down side of this approach is that runtimes are much slower when using this type. Set against that it can make debugging very much easier, certainly much easier than sprinkling code with printf statements.

When used in conjunction with the Visual C++ debugger visualisers, the value of a multiprecision type that uses this backend is displayed in the debugger just a fundamental (built-in) value would be, here we're inspecting a value of type number<debug_adaptor<cpp_dec_float<50> > >:

Otherwise you will need to expand out the view and look at the "debug_value" member:

It works for all the backend types equally too, here it is inspecting a number<debug_adaptor<gmp_rational> >:

The template alias debug_adaptor_t is used as a shortcut for converting some other number type to it's debugged equivalent, for example:

using mpfr_float_debug = debug_adaptor_t<mpfr_float>;

Defines mpfr_float_debug to be the debugged equivalent of mpfr_float.


PrevUpHomeNext