gtopt::LowercaseView class

Lazy, zero-copy view that lowercases each character on access.

Wraps a std::string_view and applies detail::to_lower_char to every character via a random-access iterator — no heap allocation occurs until the caller copies the characters somewhere (e.g. inside as_label()).

Because LowercaseView satisfies the detail::char_range concept it can be passed directly as an argument to as_label() and as_label_into():

std::string_view cn = "Generator";
auto a = as_label(lowercase(cn), 1, 2); // "generator_1_2"

Public types

class iterator
using size_type = std::size_t
using value_type = char

Constructors, destructors, conversion operators

LowercaseView() defaulted constexpr noexcept
LowercaseView(std::string_view sv) explicit constexpr noexcept
operator std::string() const explicit
Materialise the view into a std::string.

Public functions

auto begin() const -> iterator noexcept
auto empty() const -> bool noexcept
auto end() const -> iterator noexcept
auto operator==(std::string_view sv) const -> bool noexcept
Compare element-by-element (after lowercasing) with sv.
auto size() const -> size_type noexcept