35 using value_type = CharT;
48 template<std::
size_t O>
51 for (
auto i = 0_uz; i != O; ++i) {
52 _str[i] = other._str[i];
56 template<std::
size_t O>
61 _str[i] = other._str[i];
64 _str[i] = value_type{};
69 template<std::
size_t O>
72 static_assert((O - 1) <= N);
74 for (
auto i = 0_uz; i != (O - 1); ++i) {
79 template<std::
size_t O>
82 static_assert((O - 1) <= N);
85 for (; i != (O - 1); ++i) {
89 _str[i] = value_type{};
94 constexpr explicit basic_fixed_string(std::basic_string_view<value_type> str) noexcept : _str{}
96 hi_axiom(str.size() <= N);
98 for (
auto i = 0_uz; i != str.size(); ++i) {
105 hi_axiom(str.size() <= N);
107 for (
auto i = 0_uz; i != str.size(); ++i) {
117 for (; i != N and str[i] != value_type{}; ++i) {
121 hi_axiom(str[i] == value_type{});
124 operator std::basic_string_view<value_type>() const noexcept
126 return std::basic_string_view<value_type>{_str.
data(), size()};
129 [[nodiscard]]
constexpr std::size_t size() const noexcept
131 for (
auto i = 0_uz; i != N; ++i) {
132 if (_str[i] == value_type{}) {
139 [[nodiscard]]
constexpr auto begin() noexcept
144 [[nodiscard]]
constexpr auto end() noexcept
146 return _str.
begin() + size();
163 }
else if (c ==
' ') {
173 [[nodiscard]]
friend constexpr bool
175 [[nodiscard]]
friend constexpr auto
178 [[nodiscard]]
friend constexpr bool
179 operator==(std::basic_string_view<value_type>
const &lhs,
basic_fixed_string const &rhs)
noexcept
181 return lhs ==
static_cast<decltype(lhs)
>(rhs);
184 [[nodiscard]]
friend constexpr bool
185 operator==(basic_fixed_string
const &lhs, std::basic_string_view<value_type>
const &rhs)
noexcept
187 return static_cast<decltype(rhs)
>(lhs) == rhs;
209struct std::formatter<hi::basic_fixed_string<T, N>, CharT> : std::formatter<T const *, CharT> {
210 auto format(hi::basic_fixed_string<T, N>
const &t,
auto &fc)
212 return std::formatter<T const *, CharT>::format(t.data(), fc);
friend constexpr basic_fixed_string to_title(basic_fixed_string const &rhs) noexcept
Convert the current string to using title case.
Definition fixed_string.hpp:154