std::experimental::basic_string_view
來自 cppreference.com
| 定義於標頭檔案 <experimental/string_view> |
||
| template< class CharT, |
(庫基礎 TS) | |
類模板 basic_string_view 描述了一個物件,該物件可以引用一個常量連續的類字元物件序列,序列的第一個元素位於位置零。
典型的實現只包含兩個成員:一個指向常量 CharT 的指標和一個大小。
提供了用於常見字元型別的幾個 typedef
| 定義於標頭檔案
<experimental/string_view> | |
| 型別 | 定義 |
| std::experimental::string_view | std::experimental::basic_string_view<char> |
| std::experimental::wstring_view | std::experimental::basic_string_view<wchar_t> |
| std::experimental::u16string_view | std::experimental::basic_string_view<char16_t> |
| std::experimental::u32string_view | std::experimental::basic_string_view<char32_t> |
目錄 |
[編輯] 模板引數
| CharT | - | 字元型別 |
| 特性 | - | 特性類,指定字元型別的操作 |
[編輯] 成員型別
| 成員型別 | 定義 |
traits_type
|
特性
|
value_type
|
CharT
|
pointer
|
CharT*
|
const_pointer
|
const CharT*
|
reference
|
CharT&
|
const_reference
|
const CharT&
|
const_iterator
|
實現定義的 LegacyRandomAccessIterator |
iterator
|
const_iterator
|
reverse_iterator
|
const_reverse_iterator
|
const_reverse_iterator
|
std::reverse_iterator<const_iterator> |
size_type
|
std::size_t |
difference_type
|
std::ptrdiff_t |
注意:iterator 和 const_iterator 是同一型別,因為字串檢視是對常量字元序列的檢視。
[編輯] 成員函式
構造 basic_string_view(public member function) | |
| 賦值檢視 (public member function) | |
迭代器 | |
| 返回指向起始的迭代器 (public member function) | |
| 返回指向末尾的迭代器 (public member function) | |
| 返回指向起始的逆向迭代器 (public member function) | |
| 返回指向末尾的逆向迭代器 (public member function) | |
元素訪問 | |
| 訪問指定的字元 (public member function) | |
| 帶邊界檢查的訪問指定字元 (public member function) | |
| 訪問第一個字元 (public member function) | |
| 訪問最後一個字元 (public member function) | |
| 返回指向檢視首字元的指標 (public member function) | |
容量 | |
| 返回字元數 (public member function) | |
| 返回字元的最大數量 (public member function) | |
| 檢查檢視是否為空 (public member function) | |
修改器 | |
| 透過前移其起始位置來收縮檢視 (public member function) | |
| 通過後移其末尾位置來收縮檢視 (public member function) | |
| 交換內容 (public member function) | |
操作 | |
| 從檢視建立字串 (public member function) | |
| 複製字元 (public member function) | |
| 返回子字串 (public member function) | |
| 比較兩個檢視 (public member function) | |
| 在檢視中查詢字元 (public member function) | |
| 查詢子串的最後一次出現 (public member function) | |
| 查詢字元的首次出現 (public member function) | |
| 查詢字元的最後一次出現 (public member function) | |
| 查詢字元的首次缺席 (public member function) | |
| 查詢字元的最後一次缺席 (public member function) | |
常量 | |
| [靜態] |
特殊值。確切含義取決於上下文 (public static member constant) |
[編輯] 非成員函式
| 按字典序比較兩個檢視 (function template) | |
輸入/輸出 | |
| 對檢視執行流輸出 (function template) | |
[編輯] 輔助類
| 對檢視的雜湊支援 (class template specialization) |
[編輯] 特性測試宏
| __cpp_lib_experimental_string_view |
值至少為 201411 表示支援 basic_string_view 模板 (宏常量) |