|
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_string & | operator= (const CharT(&str)[N]) noexcept(bridge_type::is_nothrow_settable) |
|
JASL_CONSTEXPR_CXX14 basic_static_string & | operator= (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 |
|
| 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))) |
|
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'}).