![]() |
Home | Libraries | People | FAQ | More |
#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.
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 its 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.