58class null_terminated_string_view
59 : generic_ordering_from_three_way_compare<null_terminated_string_view>
60 , string_view_ostream_mixin<null_terminated_string_view> {
65 constexpr explicit passkey() =
default;
69 using compare_base = generic_ordering_from_three_way_compare<null_terminated_string_view>;
73 using integral_comparison_result =
int;
80 constexpr null_terminated_string_view()
noexcept
81 : null_terminated_string_view(
"") {}
85 constexpr null_terminated_string_view(null_terminated_string_view
const&) =
default;
88 constexpr auto operator=(null_terminated_string_view
const&) -> null_terminated_string_view& =
default;
91 constexpr null_terminated_string_view(null_terminated_string_view&&) =
default;
94 constexpr auto operator=(null_terminated_string_view&&) -> null_terminated_string_view& =
default;
97 ~null_terminated_string_view() =
default;
100 explicit null_terminated_string_view(std::nullptr_t) =
delete;
109 constexpr explicit null_terminated_string_view(detail::raw_c_string
const string)
noexcept;
125 template <
typename String, constraints<std::enable_if_t<std::is_same<String, std::string>::value>> =
nullptr>
127 null_terminated_string_view(String
const& string)
noexcept
129 string_(string.c_str()) {}
137 using value_type = detail::character;
139 using pointer = value_type*;
141 using const_pointer = value_type
const*;
143 using reference = value_type&;
145 using const_reference = value_type
const&;
147 using const_iterator = ::arene::base::detail::wrapped_iterator<const_pointer, passkey>;
149 using iterator = const_iterator;
151 using size_type = std::size_t;
153 using difference_type =
typename iterator::difference_type;
162 ARENE_NODISCARD
friend constexpr auto operator==(iterator
const iter, sentinel)
noexcept ->
bool {
163 return *iter.base() ==
'\0';
175 ARENE_NODISCARD
friend constexpr auto operator!=(iterator
const iter, sentinel)
noexcept ->
bool {
176 return !(iter == null_terminated_string_view::sentinel{});
183 ARENE_NODISCARD
constexpr auto begin()
const noexcept -> const_iterator {
return const_iterator{passkey{}, string_}; }
190 ARENE_NODISCARD
static constexpr auto end()
noexcept -> sentinel {
return {}; }
194 ARENE_NODISCARD
constexpr auto empty()
const noexcept ->
bool {
return begin() == end(); }
203 ARENE_NODISCARD
constexpr auto length()
const noexcept -> size_type {
return detail::string_length(string_); }
212 ARENE_NODISCARD
constexpr auto size()
const noexcept -> size_type {
return length(); }
216 ARENE_NODISCARD
constexpr auto c_str()
const noexcept -> const_pointer {
return string_; }
220 ARENE_NODISCARD
constexpr auto data()
const noexcept -> const_pointer {
return string_; }
227 constexpr operator string_view()
const noexcept {
return {data(), length()}; }
240 ARENE_NODISCARD
constexpr auto substr(std::size_t offset)
const noexcept -> null_terminated_string_view;
255 ARENE_NODISCARD
constexpr auto substr(std::size_t offset, std::size_t max_length)
const noexcept -> string_view;
264 constexpr auto compare(null_terminated_string_view
const other)
const noexcept -> integral_comparison_result {
265 return from_strong_ordering(three_way_compare(*
this, other));
275 constexpr auto compare(string_view
const& other)
const noexcept -> integral_comparison_result {
276 return from_strong_ordering(three_way_compare(*
this, other));
288 template <
typename String, constraints<std::enable_if_t<std::is_same<String, std::string>::value>> =
nullptr>
289 auto compare(String
const& other)
const noexcept -> integral_comparison_result {
290 return compare(string_view(other));
301 static constexpr auto three_way_compare(
302 null_terminated_string_view
const lhs,
303 null_terminated_string_view
const rhs
304 )
noexcept -> strong_ordering {
305 return detail::lexicographic_string_compare(lhs.c_str(), rhs.c_str());
316 static constexpr auto
317 three_way_compare(null_terminated_string_view
const lhs, detail::raw_c_string
const rhs)
noexcept -> strong_ordering {
318 return three_way_compare(lhs, null_terminated_string_view(rhs));
332 template <
typename String, constraints<std::enable_if_t<std::is_same<String, std::string>::value>> =
nullptr>
333 static auto three_way_compare(null_terminated_string_view
const lhs, String
const& rhs)
noexcept -> strong_ordering {
334 return three_way_compare(lhs, string_view{rhs});
345 static constexpr auto three_way_compare(null_terminated_string_view
const lhs, string_view
const rhs)
noexcept
347 return opposite_ordering(detail::lexicographic_string_compare({rhs.data(), rhs.size()}, lhs.c_str()));
352 detail::raw_c_string string_;
366ARENE_NODISCARD
inline constexpr auto null_terminated_string_view::substr(std::size_t offset)
const noexcept
367 -> null_terminated_string_view {
368 detail::raw_c_string start{string_};
369 while ((offset != 0U) && (*start !=
'\0')) {
371 arene::base::advance(start, 1);
374 return null_terminated_string_view{start};
403ARENE_NODISCARD
inline constexpr auto null_terminated_string_view::substr(std::size_t offset, std::size_t max_length)
404 const noexcept -> string_view {
405 auto first = begin();
406 while ((offset != 0U) && (first != end())) {
412 while ((max_length != 0U) && (last != end())) {
417 return {first.base(),
static_cast<std::size_t>(last - first)};
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10