refactor: quantity_io added

This commit is contained in:
Mateusz Pusz
2020-12-28 15:18:36 +01:00
parent 008dec79ea
commit cff718301c
24 changed files with 144 additions and 41 deletions
-15
View File
@@ -314,21 +314,6 @@ public:
#endif
[[nodiscard]] friend constexpr bool operator==(const quantity& lhs, const quantity& rhs) = default;
template<class CharT, class Traits>
friend std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, const quantity& q)
requires requires { os << q.count(); }
{
if(os.width()) {
// std::setw() applies to the whole quantity output so it has to be first put into std::string
std::basic_ostringstream<CharT, Traits> s;
detail::to_stream(s, q);
return os << s.str();
}
detail::to_stream(os, q);
return os;
}
};
// CTAD