Skip to content

Commit e19a059

Browse files
committed
split_view::base() のコードを修正
string_view は view なので説明と合わずエラーになります。 代わりに string を使うように変更しました。
1 parent 2f524bf commit e19a059

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

reference/ranges/split_view/base.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ constexpr V base() &&; // (2) C++20
2727

2828
```cpp example
2929
#include <ranges>
30-
#include <string_view>
30+
#include <string>
3131
#include <iostream>
3232

3333
int main() {
3434
using std::ranges::view;
3535
using namespace std::literals;
3636

37-
std::string_view text = "hello,world,split";
38-
std::string_view delimiter = ",";
37+
std::string text = "hello,world,split";
38+
std::string delimiter = ",";
3939

4040
std::ranges::split_view r{text, delimiter};
4141

@@ -46,9 +46,9 @@ int main() {
4646
view auto b2 = std::move(r).base();
4747

4848
// 得られるのは元のRangeではなく、あくまでview
49-
static_assert(not std::same_as<decltype(b1), std::string_view>);
50-
static_assert( std::same_as<decltype(b1), std::ranges::ref_view<std::string_view>>);
51-
static_assert( std::same_as<decltype(b2), std::ranges::ref_view<std::string_view>>);
49+
static_assert(not std::same_as<decltype(b1), std::string>);
50+
static_assert( std::same_as<decltype(b1), std::ranges::ref_view<std::string>>);
51+
static_assert( std::same_as<decltype(b2), std::ranges::ref_view<std::string>>);
5252
}
5353
```
5454
* base[color ff0000]

0 commit comments

Comments
 (0)