xo-indentlog: hex() explicit kword to avoid ambiguity w/ templates

This commit is contained in:
Roland Conybeare 2024-04-28 14:45:31 -04:00
commit 292a410f1f

View file

@ -3,6 +3,7 @@
#pragma once
#include <iostream>
#include <cstdint>
namespace xo {
/**
@ -21,7 +22,7 @@ namespace xo {
**/
struct hex {
/** @brief constructor; create stream-inserter instance */
hex(std::uint8_t x, bool w_char = false) : x_{x}, with_char_{w_char} {}
explicit hex(std::uint8_t x, bool w_char = false) : x_{x}, with_char_{w_char} {}
/**
@brief print hexadecimal byte-value on to stream.
@ -62,9 +63,8 @@ namespace xo {
@param os print on this stream
@param ins package for value to insert
**/
template<typename Stream>
Stream &
operator<< (Stream & os, hex const & ins) {
inline std::iostream &
operator<< (std::iostream & os, hex const & ins) {
ins.print(os);
return os;
}