Template Class basic_string_view

Class Documentation

template<typename CharT, typename Traits = std::char_traits<CharT>>
class basic_string_view

Public Types

using traits_type = std::char_traits<CharT>
using value_type = CharT
using pointer = const CharT*
using const_pointer = const CharT*
using reference = const CharT&
using const_reference = const CharT&
using iterator = const CharT*
using const_iterator = const CharT*
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>
using size_type = size_t
using difference_type = std::ptrdiff_t

Public Functions

basic_string_view() = default

The default constructor;.

inline basic_string_view(const CharT *str) noexcept

Construct from string literal.

inline basic_string_view(const CharT *p, size_type len) noexcept

Construct from CharT pointer and provided length.

template<typename Allocator>
inline basic_string_view(const std::basic_string<CharT, Traits, Allocator> &str) noexcept

Construct from std::string.

basic_string_view(const basic_string_view&) = default

Copy constructor.

basic_string_view &operator=(const basic_string_view&) = default

Assignment operator.

inline ~basic_string_view()

Destructor.

inline iterator begin() const noexcept

Iterator Member Functions.

inline iterator end() const noexcept
inline iterator rbegin() const noexcept
inline iterator rend() const noexcept
inline const_iterator cbegin() const noexcept
inline const_iterator cend() const noexcept
inline const_iterator crbegin() const noexcept
inline const_iterator crend() const noexcept
inline size_type length() const noexcept

Capacity Member Functions.

inline size_type size() const noexcept
inline size_type max_size() const noexcept
inline bool empty() const noexcept
inline const_reference operator[](size_type idx) const noexcept

Element Access Member Functions.

inline const_reference front() const noexcept
inline const_reference back() const noexcept
inline const_pointer data() const noexcept
inline void remove_prefix(size_type n) noexcept

Modifier Member Functions.

inline void remove_suffix(size_type n) noexcept
inline void swap(basic_string_view &other)
template<typename Allocator>
inline explicit operator std::basic_string<CharT, Traits, Allocator>() const

String Operation Member Functions.

inline size_type copy(CharT *dest, size_type n, size_type pos = 0) const noexcept
inline basic_string_view substr(size_type pos, size_type n = npos) const noexcept
inline int compare(const basic_string_view &other) const noexcept

Comparison Member Functions.

inline int compare(size_type pos, size_type n, basic_string_view other) const noexcept
inline int compare(const CharT *str) const noexcept
inline int compare(size_type pos, size_type n, const CharT *str) const noexcept
inline int compare(size_type pos, size_type n1, const CharT *str, size_type n2) const noexcept
size_type find(const CharT *str, size_type pos, size_type n) const noexcept

Find operations.

size_type find(const CharT ch, size_type pos) const noexcept
inline size_type find(basic_string_view sv, size_type pos = 0) const noexcept
inline size_type find(const CharT *str, size_type pos = 0) const noexcept
size_type rfind(const CharT *str, size_type pos, size_type n) const noexcept
size_type rfind(const CharT ch, size_type pos) const noexcept
inline size_type rfind(basic_string_view sv, size_type pos = 0) const noexcept
inline size_type rfind(const CharT *str, size_type pos = 0) const noexcept
size_type find_first_of(const CharT *str, size_type pos, size_type count) const noexcept
inline size_type find_first_of(basic_string_view str, size_type pos = 0) const noexcept
inline size_type find_first_of(CharT ch, size_type pos = 0) const noexcept
inline size_type find_first_of(const CharT *str, size_type pos = 0) const noexcept
size_type find_last_of(const CharT *str, size_type pos, size_type count) const noexcept
inline size_type find_last_of(basic_string_view str, size_type pos = npos) const noexcept
inline size_type find_last_of(CharT ch, size_type pos = npos) const noexcept
inline size_type find_last_of(const CharT *str, size_type pos = npos) const noexcept
size_type find_first_not_of(const CharT *str, size_type pos, size_type n) const noexcept
size_type find_first_not_of(CharT ch, size_type pos) const noexcept
inline size_type find_first_not_of(basic_string_view str, size_type pos = 0) const noexcept
inline size_type find_first_not_of(const CharT *str, size_type pos = 0) const noexcept
size_type find_last_not_of(const CharT *str, size_type pos, size_type n) const noexcept
size_type find_last_not_of(CharT ch, size_type pos) const noexcept
inline size_type find_last_not_of(basic_string_view str, size_type pos = npos) const noexcept
inline size_type find_last_not_of(const CharT *str, size_type pos = npos) const noexcept

Public Static Attributes

static constexpr size_type npos = size_type(-1)