| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 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 |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// UNSUPPORTED: c++03, c++11 |
| 10 |
// UNSUPPORTED: no-localization |
| 11 |
|
| 12 |
// <experimental/iterator> |
| 13 |
// |
| 14 |
// template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>> |
| 15 |
// class ostream_joiner; |
| 16 |
// |
| 17 |
// ostream_joiner(ostream_type& __os, _Delim&& __d); |
| 18 |
// ostream_joiner(ostream_type& __os, const _Delim& __d); |
| 19 |
|
| 20 |
#include <experimental/iterator> |
| 21 |
#include <iostream> |
| 22 |
#include <string> |
| 23 |
|
| 24 |
#include "test_macros.h" |
| 25 |
|
| 26 |
namespace exper = std::experimental; |
| 27 |
|
| 28 |
int main(int, char**) { |
| 29 |
const char eight = '8'; |
| 30 |
const std::string nine = "9"; |
| 31 |
#ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 32 |
const std::wstring ten = L"10"; |
| 33 |
#endif |
| 34 |
const int eleven = 11; |
| 35 |
|
| 36 |
// Narrow streams w/rvalues |
| 37 |
{ exper::ostream_joiner<char> oj(std::cout, '8'); } |
| 38 |
{ exper::ostream_joiner<std::string> oj(std::cout, std::string("9")); } |
| 39 |
#ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 40 |
{ exper::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); } |
| 41 |
#endif |
| 42 |
{ exper::ostream_joiner<int> oj(std::cout, 11); } |
| 43 |
|
| 44 |
// Narrow streams w/lvalues |
| 45 |
{ exper::ostream_joiner<char> oj(std::cout, eight); } |
| 46 |
{ exper::ostream_joiner<std::string> oj(std::cout, nine); } |
| 47 |
#ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 48 |
{ exper::ostream_joiner<std::wstring> oj(std::cout, ten); } |
| 49 |
#endif |
| 50 |
{ exper::ostream_joiner<int> oj(std::cout, eleven); } |
| 51 |
|
| 52 |
#ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 53 |
// Wide streams w/rvalues |
| 54 |
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); } |
| 55 |
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); } |
| 56 |
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); } |
| 57 |
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, 11); } |
| 58 |
|
| 59 |
// Wide streams w/lvalues |
| 60 |
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, eight); } |
| 61 |
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, nine); } |
| 62 |
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, ten); } |
| 63 |
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, eleven); } |
| 64 |
#endif |
| 65 |
|
| 66 |
return 0; |
| 67 |
} |