std::basic_string_view<CharT,Traits>::begin, std::basic_string_view<CharT,Traits>::cbegin
ja.cppreference.net より
constexpr const_iterator begin() const noexcept;
|
(C++17 以上) | |
constexpr const_iterator cbegin() const noexcept;
|
(C++17 以上) | |
ビューの最初の文字を指すイテレータを返します。
パラメータ
(なし)
戻り値
const_iterator
最初の文字へのイテレータ。
計算量
定数。
例
このコードを実行
#include <concepts> #include <string_view> int main() { constexpr std::string_view str_view("abcd"); constexpr auto begin = str_view.begin(); constexpr auto cbegin = str_view.cbegin(); static_assert( *begin == 'a' and *cbegin == 'a' and *begin == *cbegin and begin == cbegin and std::same_as<decltype(begin), decltype(cbegin)>); }
関連項目
|
終端へのイテレータを返す
(公開メンバ関数) |
|
|
(C++11)
|
先頭へのイテレータを返す
( std::basic_string<CharT,Traits,Allocator>の公開メンバ関数)
|