forked from mpusz/mp-units
removed c_str(), size(), operator<< abstractions from basic_symbol_text
This commit is contained in:
committed by
Mateusz Pusz
parent
e9272ac108
commit
f6d9a1cbda
@@ -168,8 +168,8 @@ std::basic_string<CharT> to_string(const Q& q)
|
||||
std::basic_ostringstream<CharT, Traits> s;
|
||||
s << q.count();
|
||||
constexpr auto symbol = unit_text<typename Q::dimension, typename Q::unit>();
|
||||
if constexpr (symbol.size()) {
|
||||
s << " " << symbol;
|
||||
if constexpr (symbol.standard().size()) {
|
||||
s << " " << symbol.standard();
|
||||
}
|
||||
return s.str();
|
||||
}
|
||||
|
||||
@@ -456,9 +456,9 @@ public:
|
||||
// default format should print value followed by the unit separated with 1 space
|
||||
to_quantity_buffer = units::detail::format_units_quantity_value<CharT>(to_quantity_buffer, q.count(), rep_specs);
|
||||
constexpr auto symbol = units::detail::unit_text<Dimension, Unit>();
|
||||
if(symbol.size()) {
|
||||
if(symbol.standard().size()) {
|
||||
*to_quantity_buffer++ = CharT(' ');
|
||||
format_to(to_quantity_buffer, "{}", symbol.c_str());
|
||||
format_to(to_quantity_buffer, "{}", symbol.standard().c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -21,9 +21,6 @@ struct basic_symbol_text {
|
||||
[[nodiscard]] constexpr auto& ascii() { return ascii_; }
|
||||
[[nodiscard]] constexpr const auto& ascii() const { return ascii_; }
|
||||
|
||||
[[nodiscard]] constexpr std::size_t size() const noexcept { return standard_.size(); }
|
||||
[[nodiscard]] constexpr const StandardCharT* c_str() const noexcept { return standard_.c_str(); }
|
||||
|
||||
template<std::size_t N2, std::size_t M2>
|
||||
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, ASCIICharT, N + N2, M + M2> operator+(
|
||||
const basic_symbol_text& lhs, const basic_symbol_text<StandardCharT, ASCIICharT, N2, M2>& rhs) noexcept
|
||||
@@ -67,13 +64,6 @@ struct basic_symbol_text {
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Traits>
|
||||
friend std::basic_ostream<StandardCharT, Traits>& operator<<(std::basic_ostream<StandardCharT, Traits>& os,
|
||||
const basic_symbol_text& symbol)
|
||||
{
|
||||
return os << symbol.standard_.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename StandardCharT>
|
||||
|
||||
Reference in New Issue
Block a user