std::basic_string_view<CharT,Traits>::remove_prefix
提供: cppreference.com
<tbody>
</tbody>
constexpr void remove_prefix(size_type n); |
(C++17以上) | |
ビューの開始位置を n 文字だけ前進させます。
n > size() の場合、動作は未定義です。
引数
| n | - | ビューの先頭から削除する文字数 |
戻り値
(なし)
計算量
一定。
例
Run this code
#include <iostream>
#include <algorithm>
#include <string_view>
int main()
{
std::string str = " trim me";
std::string_view v = str;
v.remove_prefix(std::min(v.find_first_not_of(" "), v.size()));
std::cout << "String: '" << str << "'\n"
<< "View : '" << v << "'\n";
}
出力:
String: ' trim me'
View : 'trim me'
関連項目
| 終点を後退させるとこによってビューを縮小させます (パブリックメンバ関数) |