xo-umbrella2/xo-unit/include/xo/unit/quantity_iostream.hpp
Roland Conybeare 60f796b770 git subrepo clone git@github.com:Rconybea/xo-unit.git xo-unit
subrepo:
  subdir:   "xo-unit"
  merged:   "f1e698bf"
upstream:
  origin:   "git@github.com:Rconybea/xo-unit.git"
  branch:   "main"
  commit:   "f1e698bf"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:22:52 -04:00

39 lines
1,020 B
C++

/** @file quantity_iostream.hpp
*
* Author: Roland Conybeare
**/
#pragma once
#include "quantity.hpp"
#include "natural_unit_iostream.hpp"
namespace xo {
namespace qty {
template < auto NaturalUnit, typename Repr >
inline std::ostream &
operator<< (std::ostream & os,
const quantity<NaturalUnit, Repr> & x)
{
os << x.scale() << x.abbrev();
return os;
}
} /*namespace qty*/
namespace print {
#ifndef ppdetail_atomic
template <auto NaturalUnit, typename Repr>
struct ppdetail<xo::qty::quantity<NaturalUnit, Repr>> {
using target_type = xo::qty::quantity<NaturalUnit, Repr>;
static bool print_pretty(const ppindentinfo & ppii,
const target_type & x) {
return ppdetail_atomic<target_type>::print_pretty(ppii, x);
}
};
#endif
} /*namespace print*/
} /*namespace xo*/
/** end quantity_iostream.hpp **/