xo-unit: + quantity printing + tests for mass units
This commit is contained in:
parent
a3c6ef6d33
commit
ab689b51df
4 changed files with 122 additions and 2 deletions
31
include/xo/unit/quantity_iostream.hpp
Normal file
31
include/xo/unit/quantity_iostream.hpp
Normal 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 **/
|
||||
Loading…
Add table
Add a link
Reference in a new issue