2020-03-24 06:59:25 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-03-26 08:23:13 +02:00
|
|
|
#include <assert.h>
|
2020-03-24 06:59:25 +02:00
|
|
|
#include <units/bits/external/fixed_string.h>
|
|
|
|
|
|
|
|
|
|
namespace units {
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT, std::size_t N, std::size_t M>
|
2020-03-24 06:59:25 +02:00
|
|
|
struct basic_symbol_text {
|
|
|
|
|
basic_fixed_string<StandardCharT, N> standard_;
|
2020-03-26 08:27:56 +02:00
|
|
|
basic_fixed_string<char, M> ascii_;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
|
|
|
|
constexpr basic_symbol_text(StandardCharT s) noexcept: standard_(s), ascii_(s) {}
|
2020-03-26 08:27:56 +02:00
|
|
|
constexpr basic_symbol_text(StandardCharT s, char a) noexcept: standard_(s), ascii_(a) {}
|
2020-03-24 06:59:25 +02:00
|
|
|
constexpr basic_symbol_text(const StandardCharT (&s)[N + 1]) noexcept: standard_(s), ascii_(s) {}
|
|
|
|
|
constexpr basic_symbol_text(const basic_fixed_string<StandardCharT, N>& s) noexcept: standard_(s), ascii_(s) {}
|
2020-03-26 08:27:56 +02:00
|
|
|
constexpr basic_symbol_text(const StandardCharT (&s)[N + 1], const char (&a)[M + 1]) noexcept: standard_(s), ascii_(a) {}
|
|
|
|
|
constexpr basic_symbol_text(const basic_fixed_string<StandardCharT, N>& s, const basic_fixed_string<char, M>& a) noexcept: standard_(s), ascii_(a) {}
|
2020-03-24 06:59:25 +02:00
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr auto& standard() { return standard_; }
|
|
|
|
|
[[nodiscard]] constexpr const auto& standard() const { return standard_; }
|
|
|
|
|
[[nodiscard]] constexpr auto& ascii() { return ascii_; }
|
|
|
|
|
[[nodiscard]] constexpr const auto& ascii() const { return ascii_; }
|
|
|
|
|
|
|
|
|
|
template<std::size_t N2, std::size_t M2>
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + N2, M + M2> operator+(
|
|
|
|
|
const basic_symbol_text& lhs, const basic_symbol_text<StandardCharT, N2, M2>& rhs) noexcept
|
2020-03-24 06:59:25 +02:00
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return basic_symbol_text<StandardCharT, N + N2, M + M2>(
|
2020-03-24 06:59:25 +02:00
|
|
|
lhs.standard_ + rhs.standard_, lhs.ascii_ + rhs.ascii_);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-25 07:22:10 +02:00
|
|
|
template<std::size_t N2>
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + N2, M + N2> operator+(
|
2020-03-25 07:22:10 +02:00
|
|
|
const basic_symbol_text& lhs, const basic_fixed_string<StandardCharT, N2>& rhs) noexcept
|
2020-03-24 06:59:25 +02:00
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return lhs + basic_symbol_text<StandardCharT, N2, N2>(rhs);
|
2020-03-24 06:59:25 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-25 07:22:10 +02:00
|
|
|
template<std::size_t N2>
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + N2, M + N2> operator+(
|
2020-03-25 07:22:10 +02:00
|
|
|
const basic_fixed_string<StandardCharT, N2>& lhs, const basic_symbol_text& rhs) noexcept
|
2020-03-24 06:59:25 +02:00
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return basic_symbol_text<StandardCharT, N2, N2>(lhs) + rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<std::size_t N2>
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + N2 - 1, M + N2 - 1> operator+(
|
2020-03-25 07:22:10 +02:00
|
|
|
const basic_symbol_text& lhs, const StandardCharT (&rhs)[N2]) noexcept
|
|
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return lhs + basic_symbol_text<StandardCharT, N2 - 1, N2 - 1>(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<std::size_t N2>
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + N2 - 1, M + N2 - 1> operator+(
|
2020-03-25 07:22:10 +02:00
|
|
|
const StandardCharT (&lhs)[N2], const basic_symbol_text& rhs) noexcept
|
|
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return basic_symbol_text<StandardCharT, N2 - 1, N2 - 1>(lhs) + rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + 1, M + 1> operator+(
|
2020-03-25 07:22:10 +02:00
|
|
|
const basic_symbol_text& lhs, StandardCharT rhs) noexcept
|
|
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return lhs + basic_symbol_text<StandardCharT, 1, 1>(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
[[nodiscard]] constexpr friend basic_symbol_text<StandardCharT, N + 1, M + 1> operator+(
|
2020-03-25 07:22:10 +02:00
|
|
|
StandardCharT lhs, const basic_symbol_text& rhs) noexcept
|
|
|
|
|
{
|
2020-03-26 08:27:56 +02:00
|
|
|
return basic_symbol_text<StandardCharT, 1, 1>(lhs) + rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-25 08:25:35 +02:00
|
|
|
#if __GNUC__ >= 10
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 08:25:35 +02:00
|
|
|
[[nodiscard]] friend constexpr auto operator<=>(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs)
|
2020-03-25 08:25:35 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
auto comparison = std::lexicographical_compare_three_way(lhs.standard_.begin(), lhs.standard_.end(), rhs.standard_.begin(), rhs.standard_.end());
|
|
|
|
|
assert(std::lexicographical_compare_three_way(lhs.ascii_.begin(), lhs.ascii_.end(), rhs.ascii_.begin(), rhs.ascii_.end()) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-25 08:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] friend constexpr auto operator<=>(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>& rhs)
|
|
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
return std::lexicographical_compare_three_way(lhs.standard_.begin(), lhs.standard_.end(), rhs.begin(), rhs.end());
|
2020-03-25 08:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] friend constexpr auto operator<=>(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT2 (&rhs)[N2])
|
|
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
return lhs <=> basic_fixed_string<StandardCharT2, N2 - 1>(rhs);
|
2020-03-25 08:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] friend constexpr auto operator<=>(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT2 rhs)
|
|
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
return lhs <=> basic_fixed_string<StandardCharT2, 1>(rhs);
|
2020-03-25 08:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 08:25:35 +02:00
|
|
|
[[nodiscard]] friend constexpr bool operator==(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs)
|
2020-03-25 08:25:35 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
bool comparison = std::equal(lhs.standard_.begin(), lhs.standard_.end(), rhs.standard_.begin(), rhs.standard_.end());
|
|
|
|
|
assert(std::equal(lhs.ascii_.begin(), lhs.ascii_.end(), rhs.ascii_.begin(), rhs.ascii_.end()) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-25 08:25:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] friend constexpr bool operator==(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>& rhs)
|
|
|
|
|
{
|
|
|
|
|
return std::equal(lhs.standard_.begin(), lhs.standard_.end(), rhs.begin(), rhs.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] friend constexpr bool operator==(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT2 (&rhs)[N2])
|
|
|
|
|
{
|
|
|
|
|
return lhs == basic_fixed_string<StandardCharT2, N2 - 1>(rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] friend constexpr bool operator==(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT2 rhs)
|
|
|
|
|
{
|
|
|
|
|
return lhs == basic_fixed_string<StandardCharT2, 1>(rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 07:22:10 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs) noexcept
|
2020-03-25 07:22:10 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
bool comparison = (lhs.standard_ == rhs.standard_);
|
|
|
|
|
assert((lhs.ascii_ == rhs.ascii_) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 07:22:10 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs) noexcept
|
2020-03-25 07:22:10 +02:00
|
|
|
{
|
|
|
|
|
return !(lhs == rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT, N>& rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ == rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT, N>& rhs) noexcept
|
|
|
|
|
{
|
|
|
|
|
return !(lhs == rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text&,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>&) noexcept
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text&,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>&) noexcept
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT (&rhs)[N + 1]) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ == rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT (&rhs)[N + 1]) noexcept
|
|
|
|
|
{
|
|
|
|
|
return !(lhs == rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text&,
|
|
|
|
|
const StandardCharT2 (&)[N2 + 1]) noexcept
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text&,
|
|
|
|
|
const StandardCharT2 (&)[N2 + 1]) noexcept
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ == rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT rhs) noexcept
|
|
|
|
|
{
|
|
|
|
|
return !(lhs == rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator==(const basic_symbol_text&,
|
|
|
|
|
StandardCharT2) noexcept
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator!=(const basic_symbol_text&,
|
|
|
|
|
StandardCharT2) noexcept
|
|
|
|
|
{
|
|
|
|
|
return true;
|
2020-03-24 06:59:25 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-24 06:59:25 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator<(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs) noexcept
|
2020-03-24 06:59:25 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
bool comparison = lhs.standard_ < rhs.standard_;
|
|
|
|
|
assert((lhs.ascii_ < rhs.ascii_) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-24 06:59:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
2020-03-25 07:22:10 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator<(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>& rhs) noexcept
|
2020-03-24 06:59:25 +02:00
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ < rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator<(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT2 (&rhs)[N2]) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ < basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator<(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT2 rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ < basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 07:22:10 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator>(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs) noexcept
|
2020-03-25 07:22:10 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
bool comparison = lhs.standard_ > rhs.standard_;
|
|
|
|
|
assert((lhs.ascii_ > rhs.ascii_) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator>(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>& rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ > rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator>(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT2 (&rhs)[N2]) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ > basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator>(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT2 rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ > basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 07:22:10 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator<=(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs) noexcept
|
2020-03-25 07:22:10 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
bool comparison = lhs.standard_ <= rhs.standard_;
|
|
|
|
|
assert((lhs.ascii_ <= rhs.ascii_) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator<=(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>& rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ <= rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator<=(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT2 (&rhs)[N2]) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ <= basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator<=(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT2 rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ <= basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT2, std::size_t N2, std::size_t M2>
|
2020-03-25 07:22:10 +02:00
|
|
|
[[nodiscard]] constexpr friend bool operator>=(const basic_symbol_text& lhs,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_symbol_text<StandardCharT2, N2, M2>& rhs) noexcept
|
2020-03-25 07:22:10 +02:00
|
|
|
{
|
2020-03-26 08:23:13 +02:00
|
|
|
bool comparison = lhs.standard_ >= rhs.standard_;
|
|
|
|
|
assert((lhs.ascii_ >= rhs.ascii_) == comparison);
|
|
|
|
|
return comparison;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator>=(const basic_symbol_text& lhs,
|
|
|
|
|
const basic_fixed_string<StandardCharT2, N2>& rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ >= rhs;
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2, std::size_t N2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator>=(const basic_symbol_text& lhs,
|
|
|
|
|
const StandardCharT2 (&rhs)[N2]) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ >= basic_fixed_string(rhs);
|
2020-03-25 07:22:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT2>
|
|
|
|
|
[[nodiscard]] constexpr friend bool operator>=(const basic_symbol_text& lhs,
|
|
|
|
|
StandardCharT2 rhs) noexcept
|
|
|
|
|
{
|
2020-03-25 08:25:35 +02:00
|
|
|
return lhs.standard_ >= basic_fixed_string(rhs);
|
2020-03-24 06:59:25 +02:00
|
|
|
}
|
2020-03-25 08:25:35 +02:00
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-03-24 06:59:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename StandardCharT>
|
2020-03-26 08:27:56 +02:00
|
|
|
basic_symbol_text(StandardCharT) -> basic_symbol_text<StandardCharT, 1, 1>;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT>
|
|
|
|
|
basic_symbol_text(StandardCharT, char) -> basic_symbol_text<StandardCharT, 1, 1>;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
|
|
|
|
template<typename StandardCharT, std::size_t N>
|
2020-03-26 08:27:56 +02:00
|
|
|
basic_symbol_text(const StandardCharT (&)[N]) -> basic_symbol_text<StandardCharT, N - 1, N - 1>;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
|
|
|
|
template<typename StandardCharT, std::size_t N>
|
2020-03-26 08:27:56 +02:00
|
|
|
basic_symbol_text(const basic_fixed_string<StandardCharT, N>&) -> basic_symbol_text<StandardCharT, N, N>;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT, std::size_t N, std::size_t M>
|
|
|
|
|
basic_symbol_text(const StandardCharT (&)[N], const char (&)[M]) -> basic_symbol_text<StandardCharT, N - 1, M - 1>;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
2020-03-26 08:27:56 +02:00
|
|
|
template<typename StandardCharT, std::size_t N, std::size_t M>
|
2020-03-25 07:22:10 +02:00
|
|
|
basic_symbol_text(const basic_fixed_string<StandardCharT, N>&,
|
2020-03-26 08:27:56 +02:00
|
|
|
const basic_fixed_string<char, M>&)
|
|
|
|
|
-> basic_symbol_text<StandardCharT, N, M>;
|
2020-03-24 06:59:25 +02:00
|
|
|
|
|
|
|
|
} // namespace units
|