ModErn Text Analysis
META Enumerates Textual Applications
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
meta::util::basic_string_view< Char, Traits > Class Template Reference

A non-owning reference to a string. More...

#include <string_view.h>

Public Types

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

Public Member Functions

constexpr basic_string_view (const basic_string_view &) noexcept=default
 
basic_string_viewoperator= (const basic_string_view &) noexcept=default
 
template<class Allocator >
 basic_string_view (const std::basic_string< Char, Traits, Allocator > &str) noexcept
 
constexpr basic_string_view (const Char *str)
 
constexpr basic_string_view (const Char *str, size_type len)
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator crend () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr size_type length () const noexcept
 
constexpr size_type max_size () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr const_reference operator[] (size_type pos) const
 
const_reference at (size_type pos) const
 
constexpr const_reference front () const
 
constexpr const_reference back () const
 
constexpr const_pointer data () const noexcept
 
void clear () noexcept
 
void remove_prefix (size_type n)
 
void remove_suffix (size_type n)
 
void swap (basic_string_view &s) noexcept
 
template<class Allocator >
 operator std::basic_string< Char, Traits, Allocator > () const
 
template<class Allocator = std::allocator<Char>>
std::basic_string< Char, Traits, Allocator > to_string (const Allocator &a=Allocator{}) const
 
size_type copy (Char *s, size_type n, size_type pos=0) const
 
constexpr basic_string_view substr (size_type pos=0, size_type n=npos) const
 
int compare (basic_string_view s) const noexcept
 
constexpr int compare (size_type pos1, size_type n1, basic_string_view s) const
 
constexpr int compare (size_type pos1, size_type n1, basic_string_view s, size_type pos2, size_type n2) const
 
constexpr int compare (const Char *s) const
 
constexpr int compare (size_type pos1, size_type n1, const Char *s) const
 
constexpr int compare (size_type pos1, size_type n1, const Char *s, size_type n2) const
 
size_type find (basic_string_view s, size_type pos=0) const noexcept
 
constexpr size_type find (Char c, size_type pos=0) const noexcept
 
constexpr size_type find (const Char *s, size_type pos, size_type n) const
 
constexpr size_type find (const Char *s, size_type pos=0) const
 
size_type rfind (basic_string_view s, size_type pos=npos) const noexcept
 
constexpr size_type rfind (Char c, size_type pos=npos) const noexcept
 
constexpr size_type rfind (const Char *s, size_type pos, size_type n) const
 
constexpr size_type rfind (const Char *s, size_type pos=npos) const
 
size_type find_first_of (basic_string_view s, size_type pos=0) const noexcept
 
constexpr size_type find_first_of (Char c, size_type pos=0) const noexcept
 
constexpr size_type find_first_of (const Char *s, size_type pos, size_type n) const
 
constexpr size_type find_first_of (const Char *s, size_type pos=0) const
 
size_type find_last_of (basic_string_view s, size_type pos=npos) const noexcept
 
constexpr size_type find_last_of (Char c, size_type pos=npos) const noexcept
 
constexpr size_type find_last_of (const Char *s, size_type pos, size_type n) const
 
constexpr size_type find_last_of (const Char *s, size_type pos=npos) const
 
size_type find_first_not_of (basic_string_view s, size_type pos=0) const noexcept
 
constexpr size_type find_first_not_of (Char c, size_type pos=0) const noexcept
 
constexpr size_type find_first_not_of (const Char *s, size_type pos, size_type n) const
 
constexpr size_type find_first_not_of (const Char *s, size_type pos=0) const
 
size_type find_last_not_of (basic_string_view s, size_type pos=npos) const noexcept
 
constexpr size_type find_last_not_of (Char c, size_type pos=npos) const noexcept
 
constexpr size_type find_last_not_of (const Char *s, size_type pos, size_type n) const
 
constexpr size_type find_last_not_of (const Char *s, size_type pos=npos) const
 

Static Public Attributes

static constexpr size_type npos = size_type(-1)
 

Private Attributes

const_pointer data_
 
size_type size_
 

Detailed Description

template<class Char, class Traits = std::char_traits<Char>>
class meta::util::basic_string_view< Char, Traits >

A non-owning reference to a string.

I make no claims that this is completely standards-compliant—this is just a best-effort attempt at implementing what we need for MeTA. I have built this using its paper's wording for the Fundamentals TS.

See also
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3921.html

The documentation for this class was generated from the following file: