[ Web Proxy ]
URL:
Viewing: http://ru.cppreference.com/cpp/string/basic_string_view [Back]  [Original]

std::basic_string_view cppreference.com
cppreference.com

std::basic_string_view

cppreference.com
<tbody> </tbody>
template< class CharT, class Traits = std::char_traits<CharT> > class basic_string_view;
( C++17)

basic_string_view , CharT .

std::basic_string_view TriviallyCopyable.

( C++23)

: CharT .

:

<string_view>
std::string_view std::basic_string_view<char>
std::wstring_view std::basic_string_view<wchar_t>
std::u8string_view (C++20) std::basic_string_view<char8_t>
std::u16string_view std::basic_string_view<char16_t>
std::u32string_view std::basic_string_view<char32_t>

CharT
Traits CharTraits . std::basic_string, Traits::char_type , CharT, .

traits_type Traits
value_type CharT
pointer CharT*
const_pointer const CharT*
reference CharT&
const_reference const CharT&
const_iterator LegacyRandomAccessIterator
and LegacyContiguousIterator ( C++20)
ConstexprIterator, and contiguous_iterator ( C++20)

whose value_type is CharT

iterator const_iterator
const_reverse_iterator std::reverse_iterator<const_iterator>
reverse_iterator const_reverse_iterator
size_type std::size_t
difference_type std::ptrdiff_t

: iterator const_iterator , .

Container iterator const_iterator basic_string_view.

-

(C++17)
basic_string_view
(public -) []
(C++17)

(public -) []

(public -) []
(C++17)

(public -) []

(public -) []
(C++17)

(public -) []

(public -) []
(C++17)

(public -) []
(C++17)

(public -) []
(C++17)

(public -) []
(C++17)

(public -) []

(public -) []
(C++17)

(public -) []
(C++17)
,
(public -) []
,
(public -) []
,
(public -) []
(C++17)

(public -) []
(C++17)

(public -) []
(C++17)

(public -) []
(C++17)

(public -) []
,
(public -) []
(C++20)
,
(public -) []
(C++23)
,
(public -) []
(C++17)

(public -) []
(C++17)

(public -) []

(public -) []

(public -) []

(public -) []

(public -) []

[static] (C++17)
.
(public static -) []

,

(C++17)( C++20)( C++20)( C++20)( C++20)( C++20)(C++20)

( ) []
/

( ) []


() []


( ) []

<tbody> </tbody>
template<class CharT, class Traits> inline constexpr bool ranges::enable_borrowed_range<std::basic_string_view<CharT, Traits>> = true;
( C++20)

std::ranges::enable_borrowed_range basic_string_view borrowed_range.

<tbody> </tbody>
template<class CharT, class Traits> inline constexpr bool ranges::enable_view<std::basic_string_view<CharT, Traits>> = true;
( C++20)

std::ranges::enable_view basic_string_view view.

( C++20)

, std::string_view , :

std::string_view good {" "};
  // "" : `good`    .  
  //      .

std::string_view bad {" "s};	
  // "" : `bad`   ,   std::string,	
  //  std::operator""s,     .

std::basic_string_view , , C++23.

__cpp_lib_string_view 201606L (C++17) std::string_view
201803L (C++20) ConstexprIterator
__cpp_lib_string_contains 202011L (C++23) contains

#include <iostream>
#include <string_view>

int main() {
    constexpr std::string_view unicode[] {
        "", "", "", ""
    };

    for (int y{}, p{}; y != 6; ++y, p = ((p + 1) % 4)) {
        for (int x{}; x != 16; ++x)
            std::cout << unicode[p];
        std::cout << '\n';
    }
}

:








( ) []
(C++20)

( ) []
,
( ) []

Web Proxy Viewer  |  New URL  |  Original Page