class basic_string_view

Declaration

template <typename Char>
class basic_string_view { /* full declaration omitted */ };

Description

An implementation of ``std::basic_string_view`` for pre-C++17. It provides a subset of the API. ``fmt::basic_string_view`` is used for format strings even if ``std::string_view`` is available to prevent issues when a library is compiled with a different ``-std`` option than the client code (which is not recommended).

Declared at: third_party/fmt/include/fmt/core.h:397

Templates

Char

Method Overview

  • public constexpr basic_string_view<Char>() noexcept
  • public constexpr basic_string_view<Char>(const Char * s, size_t count) noexcept
  • public inline constexpr basic_string_view<Char>(const Char * s)
  • public template <typename Traits, typename Alloc>constexpr basic_string_view<Char>(const std::basic_string<Char, Traits, Alloc> & s) noexcept
  • public template <typename S, fmt::enable_if_t<(std::is_same<S, detail::std_string_view<Char>>::value), int> = 0>constexpr basic_string_view<Char>(S s) noexcept
  • public constexpr auto begin() const noexcept -> fmt::basic_string_view::iterator
  • public constexpr auto compare(basic_string_view<Char> other) const -> int
  • public constexpr auto data() const noexcept -> const Char *
  • public constexpr auto end() const noexcept -> fmt::basic_string_view::iterator
  • public constexpr void remove_prefix(size_t n) noexcept
  • public constexpr auto size() const noexcept -> size_t
  • public constexpr bool starts_with(basic_string_view<Char> sv) const noexcept
  • public constexpr bool starts_with(Char c) const noexcept
  • public constexpr bool starts_with(const Char * s) const

Methods

constexpr basic_string_view<Char>() noexcept

Declared at: third_party/fmt/include/fmt/core.h:406

constexpr basic_string_view<Char>(
    const Char* s,
    size_t count) noexcept

Description

Constructs a string reference object from a C string and a size.

Declared at: third_party/fmt/include/fmt/core.h:409

Parameters

const Char* s
size_t count

inline constexpr basic_string_view<Char>(
    const Char* s)

Description

\rstConstructs a string reference object from a C string computing the size with ``std::char_traits <Char >::length``.\endrst

Declared at: third_party/fmt/include/fmt/core.h:420

Parameters

const Char* s

template <typename Traits, typename Alloc>
constexpr basic_string_view<Char>(
    const std::basic_string<Char, Traits, Alloc>&
        s) noexcept

Description

Constructs a string reference from a ``std::basic_string`` object.

Declared at: third_party/fmt/include/fmt/core.h:429

Templates

Traits
Alloc

Parameters

const std::basic_string<Char, Traits, Alloc>& s

template <
    typename S,
    fmt::enable_if_t<
        (std::is_same<S,
                      detail::std_string_view<
                          Char>>::value),
        int> = 0>
constexpr basic_string_view<Char>(S s) noexcept

Declared at: third_party/fmt/include/fmt/core.h:435

Templates

S
fmt::enable_if_t<(std::is_same>::value), int>

Parameters

S s

constexpr auto begin() const noexcept
    -> fmt::basic_string_view::iterator

Declared at: third_party/fmt/include/fmt/core.h:444

constexpr auto compare(
    basic_string_view<Char> other) const -> int

Declared at: third_party/fmt/include/fmt/core.h:469

Parameters

basic_string_view<Char> other

constexpr auto data() const noexcept
    -> const Char*

Description

Returns a pointer to the string data.

Declared at: third_party/fmt/include/fmt/core.h:439

constexpr auto end() const noexcept
    -> fmt::basic_string_view::iterator

Declared at: third_party/fmt/include/fmt/core.h:445

constexpr void remove_prefix(size_t n) noexcept

Declared at: third_party/fmt/include/fmt/core.h:451

Parameters

size_t n

constexpr auto size() const noexcept -> size_t

Description

Returns the string size.

Declared at: third_party/fmt/include/fmt/core.h:442

constexpr bool starts_with(
    basic_string_view<Char> sv) const noexcept

Declared at: third_party/fmt/include/fmt/core.h:456

Parameters

basic_string_view<Char> sv

constexpr bool starts_with(Char c) const noexcept

Declared at: third_party/fmt/include/fmt/core.h:461

Parameters

Char c

constexpr bool starts_with(const Char* s) const

Declared at: third_party/fmt/include/fmt/core.h:464

Parameters

const Char* s