1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-localization
10 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // Some basic examples of how istream_view might be used in the wild. This is a general
13 // collection of sample algorithms and functions that try to mock general usage of
21 #include "test_macros.h"
24 template <class CharT
>
26 auto ints
= make_string_stream
<CharT
>("0 1 2 3 4");
27 auto oss
= std::basic_ostringstream
<CharT
>{};
28 auto delimiter
= make_string
<CharT
>("-");
30 std::ranges::basic_istream_view
<int, CharT
>(ints
), std::ostream_iterator
<int, CharT
>{oss
, delimiter
.c_str()});
31 auto expected
= make_string
<CharT
>("0-1-2-3-4-");
32 assert(oss
.str() == expected
);
35 int main(int, char**) {
37 #ifndef TEST_HAS_NO_WIDE_CHARACTERS