An implementation of std::basic_string_view for pre‐C++17 providing a subset of the API. fmt::basic_string_view is used in the public API even if std::basic_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).

Synopsis

Declared in <fmt/base.h>

template<typename Char>
class basic_string_view;

Type Aliases

Name

Description

iterator

The iterator type used to traverse the string view.

value_type

The character type stored in the string view.

Member Functions

Name

Description

basic_string_view [constructor]

Constructors

begin

An iterator to the first character of the view.

compare

Lexicographically compares this view with other.

data

A pointer to the first character of the view.

end

An iterator past the last character of the view.

operator[]

A reference to the character at pos.

remove_prefix

Removes the first n characters from the view.

size

The number of characters in the view.

starts_with

starts_with overloads

Friends

Name

Description

fmt::operator>=

true if lhs is lexicographically greater than or equal to.

fmt::operator>

true if lhs is lexicographically greater than rhs.

fmt::operator<=

true if lhs is lexicographically less than or equal to.

fmt::operator<

true if lhs is lexicographically less than rhs.

fmt::operator!=

true if lhs and rhs are not equal.

fmt::operator==

true if lhs and rhs are equal.

Non-Member Functions

Name

Description

sprintf

A deprecated wchar_t overload of sprintf.

vformat

Formats args according to specifications in fmt, with an exotic (non‐`char`) character type, and returns the result as a string.

vsprintf

Formats args according to specifications in fmt and returns the result as a string.

Created with MrDocs