16 #ifndef LARDATA_RECOBASEART_DUMPERS_HEXFLOAT_H
17 #define LARDATA_RECOBASEART_DUMPERS_HEXFLOAT_H 1
21 #include <type_traits>
38 !std::is_same<std::decay_t<T>,
float>::
value,
39 "OptionalHexFloatFormatter does not support float values"
46 template <
typename Stream>
48 {
write(std::forward<Stream>(os),
value);
return os; }
52 template <
typename Stream>
60 template <
typename Stream>
63 constexpr
auto buf_size = 8 *
sizeof(
real_t) + 1;
65 std::snprintf(buf, buf_size,
"%+24.14a", v);
70 template <
typename Stream>
80 std::ostream&
operator<<
124 template <
typename T>
128 template <
typename T>
133 template <
typename T>
144 #endif // LARDATA_RECOBASEART_DUMPERS_HEXFLOAT_H
OptionalHexFloat(bool start_active=true)
Constructor: if start_active is true, it will print floats in base 16.
void disable()
Disables base 16 printing.
auto operator()(T value) const
Returns an object that knows what to do with an output stream.
Helper for formatting floats in base 16.
void enable(bool enable=true)
Enables base 16 printing (or disables it if enable is false)
bool active
whether we are writing in base 16
bool enabled() const
Returns whether base 16 printing is enabled.