//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: no-localization // UNSUPPORTED: c++03, c++11, c++14, c++17 // Some basic examples of how istream_view might be used in the wild. This is a general // collection of sample algorithms and functions that try to mock general usage of // this view. #include #include #include #include #include "test_macros.h" #include "utils.h" template void test() { auto ints = make_string_stream("0 1 2 3 4"); auto oss = std::basic_ostringstream{}; auto delimiter = make_string("-"); std::ranges::copy( std::ranges::basic_istream_view(ints), std::ostream_iterator{oss, delimiter.c_str()}); auto expected = make_string("0-1-2-3-4-"); assert(oss.str() == expected); } int main(int, char**) { test(); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test(); #endif return 0; }