forked from mpusz/mp-units
refactor: More stream-specific implementation moved to quantity_io.h
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include <units/bits/external/text_tools.h>
|
||||
#include <units/prefix.h>
|
||||
#include <units/derived_dimension.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace units::detail {
|
||||
|
||||
@@ -178,14 +177,4 @@ constexpr auto unit_text()
|
||||
}
|
||||
}
|
||||
|
||||
template<typename CharT, class Traits, typename D, typename U, typename Rep>
|
||||
void to_stream(std::basic_ostream<CharT, Traits>& os, const quantity<D, U, Rep>& q)
|
||||
{
|
||||
os << q.count();
|
||||
constexpr auto symbol = detail::unit_text<D, U>();
|
||||
if constexpr (symbol.standard().size()) {
|
||||
os << " " << symbol.standard();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace units::detail
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include <units/generic/dimensionless.h>
|
||||
#include <units/quantity_cast.h>
|
||||
#include <compare>
|
||||
#include <ostream>
|
||||
|
||||
namespace units {
|
||||
|
||||
|
@@ -25,9 +25,24 @@
|
||||
|
||||
#include <units/bits/external/fixed_string_io.h>
|
||||
#include <units/quantity.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename CharT, class Traits, typename D, typename U, typename Rep>
|
||||
void to_stream(std::basic_ostream<CharT, Traits>& os, const quantity<D, U, Rep>& q)
|
||||
{
|
||||
os << q.count();
|
||||
constexpr auto symbol = detail::unit_text<D, U>();
|
||||
if constexpr (symbol.standard().size()) {
|
||||
os << " " << symbol.standard();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<typename CharT, typename Traits, typename D, typename U, typename Rep>
|
||||
std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, const quantity<D, U, Rep>& q)
|
||||
requires requires { os << q.count(); }
|
||||
|
Reference in New Issue
Block a user