std::basic_string_view<CharT,Traits>::begin, std::basic_string_view<CharT,Traits>::cbegin
From 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。
[編集] 計算量
定数。
[編集] 例
このコードを実行
#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)>); }
[編集] 関連項目
| 末尾へのイテレータを返す (public member function) | |
| (C++11) |
先頭へのイテレータを返す (public member function of std::basic_string<CharT,Traits,Allocator>) |