1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03, c++11 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 exp = std::experimental; 27 28 int main () { 29 const char eight = '8'; 30 const std::string nine = "9"; 31 const std::wstring ten = L"10"; 32 const int eleven = 11; 33 34 // Narrow streams w/rvalues 35 { exp::ostream_joiner<char> oj(std::cout, '8'); } 36 { exp::ostream_joiner<std::string> oj(std::cout, std::string("9")); } 37 { exp::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); } 38 { exp::ostream_joiner<int> oj(std::cout, 11); } 39 40 // Narrow streams w/lvalues 41 { exp::ostream_joiner<char> oj(std::cout, eight); } 42 { exp::ostream_joiner<std::string> oj(std::cout, nine); } 43 { exp::ostream_joiner<std::wstring> oj(std::cout, ten); } 44 { exp::ostream_joiner<int> oj(std::cout, eleven); } 45 46 // Wide streams w/rvalues 47 { exp::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); } 48 { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); } 49 { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); } 50 { exp::ostream_joiner<int, wchar_t> oj(std::wcout, 11); } 51 52 // Wide streams w/lvalues 53 { exp::ostream_joiner<char, wchar_t> oj(std::wcout, eight); } 54 { exp::ostream_joiner<std::string, wchar_t> oj(std::wcout, nine); } 55 { exp::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, ten); } 56 { exp::ostream_joiner<int, wchar_t> oj(std::wcout, eleven); } 57 58 } 59