std::basic_string_view<CharT,Traits>::begin, std::basic_string_view<CharT,Traits>::cbegin
提供: cppreference.com
< cpp | string | basic string view
constexpr const_iterator begin() const noexcept; |
(C++17以上) | |
constexpr const_iterator cbegin() const noexcept; |
(C++17以上) | |
ビューの最初の文字を指すイテレータを返します。
目次 |
[編集] 引数
(なし)
[編集] 戻り値
最初の要素を指す const_iterator
。
[編集] 計算量
一定。
[編集] 例
Run this code
#include <iostream> #include <string_view> int main() { std::string_view str_view("abcd"); auto begin = str_view.begin(); auto cbegin = str_view.cbegin(); std::cout << *begin << '\n'; std::cout << *cbegin << '\n'; std::cout << std::boolalpha << (begin == cbegin) << '\n'; std::cout << std::boolalpha << (*begin == *cbegin) << '\n'; }
出力:
a a true true
[編集] 関連項目
終端を指すイテレータを返します (パブリックメンバ関数) |