xo-unit: + quantity printing + tests for mass units

This commit is contained in:
Roland Conybeare 2024-04-28 19:12:40 -04:00
commit ab689b51df
4 changed files with 122 additions and 2 deletions

View file

@ -0,0 +1,31 @@
/** @file quantity_iostream.hpp
*
* Author: Roland Conybeare
**/
#pragma once
#include "quantity.hpp"
#include "natural_unit_iostream.hpp"
namespace xo {
namespace qty {
template <
typename Repr = double,
typename Int = std::int64_t,
natural_unit<Int> NaturalUnit = natural_unit<Int>(),
typename Int2x = detail::width2x<Int>
>
inline std::ostream &
operator<< (std::ostream & os,
const quantity<Repr, Int, NaturalUnit, Int2x> & x)
{
os << x.scale() << x.abbrev();
return os;
}
} /*namespace qty*/
} /*namespace xo*/
/** end quantity_iostream.hpp **/