JASL  [1.2.0]-2018-09-11
Public Types | Public Member Functions | List of all members
jasl::basic_static_string< CharT, Traits > Class Template Reference
Inheritance diagram for jasl::basic_static_string< CharT, Traits >:
jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >

Public Types

typedef inner::string_view_bridge< basic_string_view< CharT, Traits > > bridge_type
 
typedef bridge_type::bridge_to_type base_type
 
- Public Types inherited from jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >
typedef basic_string_view< CharT, Traits > bridge_to_type
 
typedef basic_string_view< CharT, Traits > ::traits_type traits_type
 
typedef basic_string_view< CharT, Traits > ::value_type value_type
 
typedef basic_string_view< CharT, Traits > ::pointer pointer
 
typedef basic_string_view< CharT, Traits > ::const_pointer const_pointer
 
typedef basic_string_view< CharT, Traits > ::reference reference
 
typedef basic_string_view< CharT, Traits > ::const_reference const_reference
 
typedef basic_string_view< CharT, Traits > ::const_iterator const_iterator
 
typedef basic_string_view< CharT, Traits > ::iterator iterator
 
typedef basic_string_view< CharT, Traits > ::const_reverse_iterator const_reverse_iterator
 
typedef basic_string_view< CharT, Traits > ::reverse_iterator reverse_iterator
 
typedef basic_string_view< CharT, Traits > ::size_type size_type
 
typedef basic_string_view< CharT, Traits > ::difference_type difference_type
 

Public Member Functions

template<size_t N>
constexpr basic_static_string (const CharT(&str)[N]) noexcept(std::is_nothrow_constructible< bridge_type, const CharT *, size_t >::value)
 
constexpr basic_static_string (const basic_static_string &other) noexcept(std::is_nothrow_constructible< bridge_type, const bridge_type &>::value)
 
template<size_t N>
JASL_CONSTEXPR_CXX14 basic_static_stringoperator= (const CharT(&str)[N]) noexcept(bridge_type::is_nothrow_settable)
 
JASL_CONSTEXPR_CXX14 basic_static_stringoperator= (const basic_static_string &other) noexcept(std::is_nothrow_assignable< bridge_type, const bridge_type &>::value)
 
JASL_CONSTEXPR_CXX14 void swap (basic_static_string &other) noexcept(JASL_is_nothrow_swappable_value(bridge_type))
 
constexpr basic_static_string substr (typename bridge_type::size_type pos, typename bridge_type::size_type count=bridge_type::npos) const
 
- Public Member Functions inherited from jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >
 operator basic_string_view< CharT, Traits > () const noexcept
 
constexpr const_iterator begin () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().begin()))
 
constexpr const_iterator end () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().end()))
 
constexpr const_iterator cbegin () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().cbegin()))
 
constexpr const_iterator cend () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().cend()))
 
const_reverse_iterator rbegin () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rbegin()))
 
const_reverse_iterator rend () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rend()))
 
const_reverse_iterator crbegin () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().crbegin()))
 
const_reverse_iterator crend () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().crend()))
 
constexpr size_type size () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().size()))
 
constexpr size_type length () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().length()))
 
constexpr size_type max_size () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().max_size()))
 
constexpr bool empty () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().empty()))
 
constexpr const_reference operator[] (size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >()[pos]))
 
constexpr const_reference at (size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().at(pos)))
 
constexpr const_reference front () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().front()))
 
constexpr const_reference back () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().back()))
 
constexpr const_pointer data () const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().data()))
 
JASL_CONSTEXPR_CXX14 void remove_prefix (size_type n) noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().remove_prefix(n)))
 
JASL_CONSTEXPR_CXX14 void remove_suffix (size_type n) noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().remove_suffix(n)))
 
size_type copy (value_type *s, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().copy(s, n)))
 
size_type copy (value_type *s, size_type n, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().copy(s, n, pos)))
 
constexpr string_view_bridge substr (size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().substr(pos)) &&std::is_nothrow_copy_constructible< basic_string_view< CharT, Traits > >::value &&std::is_nothrow_copy_constructible< string_view_bridge >::value)
 
constexpr string_view_bridge substr (size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().substr(pos, n)) &&std::is_nothrow_copy_constructible< basic_string_view< CharT, Traits > >::value &&std::is_nothrow_copy_constructible< string_view_bridge >::value)
 
constexpr int compare (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().compare(s._sv)))
 
constexpr int compare (size_type pos1, size_type n1, string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().compare(pos1, n1, s._sv)))
 
constexpr int compare (size_type pos1, size_type n1, string_view_bridge s, size_type pos2, size_type n2) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().compare(pos1, n1, s._sv, pos2, n2)))
 
constexpr int compare (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().compare(s)))
 
constexpr int compare (size_type pos1, size_type n1, const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().compare(pos1, n1, s)))
 
constexpr int compare (size_type pos1, size_type n1, const value_type *s, size_type n2) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().compare(pos1, n1, s, n2)))
 
constexpr size_type find (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(s._sv)))
 
constexpr size_type find (string_view_bridge s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(s._sv, pos)))
 
constexpr size_type find (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(c)))
 
constexpr size_type find (value_type c, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(c, pos)))
 
constexpr size_type find (const value_type *s, size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(s, pos, n)))
 
constexpr size_type find (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(s)))
 
constexpr size_type find (const value_type *s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find(s, pos)))
 
constexpr size_type rfind (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(s._sv)))
 
constexpr size_type rfind (string_view_bridge s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(s._sv, pos)))
 
constexpr size_type rfind (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(c)))
 
constexpr size_type rfind (value_type c, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(c, pos)))
 
constexpr size_type rfind (const value_type *s, size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(s, pos, n)))
 
constexpr size_type rfind (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(s)))
 
constexpr size_type rfind (const value_type *s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().rfind(s, pos)))
 
constexpr size_type find_first_of (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(s._sv)))
 
constexpr size_type find_first_of (string_view_bridge s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(s._sv, pos)))
 
constexpr size_type find_first_of (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(c)))
 
constexpr size_type find_first_of (value_type c, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(c, pos)))
 
constexpr size_type find_first_of (const value_type *s, size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(s, pos, n)))
 
constexpr size_type find_first_of (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(s)))
 
constexpr size_type find_first_of (const value_type *s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_of(s, pos)))
 
constexpr size_type find_last_of (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(s._sv)))
 
constexpr size_type find_last_of (string_view_bridge s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(s._sv, pos)))
 
constexpr size_type find_last_of (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(c)))
 
constexpr size_type find_last_of (value_type c, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(c, pos)))
 
constexpr size_type find_last_of (const value_type *s, size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(s, pos, n)))
 
constexpr size_type find_last_of (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(s)))
 
constexpr size_type find_last_of (const value_type *s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_of(s, pos)))
 
constexpr size_type find_first_not_of (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(s._sv)))
 
constexpr size_type find_first_not_of (string_view_bridge s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(s._sv, pos)))
 
constexpr size_type find_first_not_of (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(c)))
 
constexpr size_type find_first_not_of (value_type c, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(c, pos)))
 
constexpr size_type find_first_not_of (const value_type *s, size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(s, pos, n)))
 
constexpr size_type find_first_not_of (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(s)))
 
constexpr size_type find_first_not_of (const value_type *s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_first_not_of(s, pos)))
 
constexpr size_type find_last_not_of (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(s._sv)))
 
constexpr size_type find_last_not_of (string_view_bridge s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(s._sv, pos)))
 
constexpr size_type find_last_not_of (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(c)))
 
constexpr size_type find_last_not_of (value_type c, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(c, pos)))
 
constexpr size_type find_last_not_of (const value_type *s, size_type pos, size_type n) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(s, pos, n)))
 
constexpr size_type find_last_not_of (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(s)))
 
constexpr size_type find_last_not_of (const value_type *s, size_type pos) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().find_last_not_of(s, pos)))
 
constexpr bool starts_with (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().starts_with(s._sv)))
 
constexpr bool starts_with (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().starts_with(c)))
 
constexpr bool starts_with (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().starts_with(s)))
 
constexpr bool ends_with (string_view_bridge s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().ends_with(s._sv)))
 
constexpr bool ends_with (value_type c) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().ends_with(c)))
 
constexpr bool ends_with (const value_type *s) const noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().ends_with(s)))
 

Additional Inherited Members

- Static Public Attributes inherited from jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >
static constexpr size_type npos
 
- Protected Member Functions inherited from jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >
constexpr string_view_bridge (basic_string_view< CharT, Traits > s) noexcept(std::is_nothrow_constructible< basic_string_view< CharT, Traits >, basic_string_view< CharT, Traits > >::value)
 
constexpr string_view_bridge (const string_view_bridge &s) noexcept(std::is_nothrow_copy_constructible< basic_string_view< CharT, Traits > >::value)=default
 
constexpr string_view_bridge (const value_type *str) noexcept(std::is_nothrow_constructible< basic_string_view< CharT, Traits >, const value_type * >::value)
 
constexpr string_view_bridge (const value_type *str, size_type len) noexcept(std::is_nothrow_constructible< basic_string_view< CharT, Traits >, const value_type *, size_type >::value)
 
string_view_bridgeoperator= (const string_view_bridge &) noexcept(std::is_nothrow_copy_assignable< basic_string_view< CharT, Traits > >::value)=default
 
JASL_CONSTEXPR_CXX14 void swap (string_view_bridge &s) noexcept(noexcept(std::declval< basic_string_view< CharT, Traits > >().swap(s._sv)))
 
JASL_CONSTEXPR_CXX14 void set (const value_type *str, size_type len) noexcept(is_nothrow_settable)
 
- Protected Attributes inherited from jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >
basic_string_view< CharT, Traits > _sv
 
- Static Protected Attributes inherited from jasl::inner::string_view_bridge< basic_string_view< CharT, Traits > >
static constexpr bool is_nothrow_settable
 

Detailed Description

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

This class derives from [std::string_view] (or optionally from [jasl::string_view]). What is special about it is that you can only assign (or construct with) character arrays to it but not pointers. This makes it safer and faster comparing to string_view-s.

Remarks: Why is there no c_str method? While jasl::static_string("one") is null terminated, jasl::static_string({'t', 'w', 'o'}) is not. In both cases the size()/length() of them will be 3, so the terminating null character will be here in the first case but it won't be counted. If you want the null terminator as a part of it, write jasl::static_string("one\0") or jasl::static_string({'t', 'w', 'o', '\0', '\0'}).


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