libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

ostream.pass.cpp (963B)


      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 // <iterator>
     11 
     12 // class ostream_iterator
     13 
     14 // ostream_iterator(ostream_type& s);
     15 
     16 #include <iterator>
     17 #include <sstream>
     18 #include <cassert>
     19 
     20 struct MyTraits : std::char_traits<char> {};
     21 
     22 typedef std::basic_ostringstream<char, MyTraits> StringStream;
     23 typedef std::basic_ostream<char, MyTraits> BasicStream;
     24 
     25 void operator&(BasicStream const&) {}
     26 
     27 int main()
     28 {
     29     {
     30         std::ostringstream outf;
     31         std::ostream_iterator<int> i(outf);
     32         assert(outf.good());
     33     }
     34     {
     35         StringStream outf;
     36         std::ostream_iterator<int, char, MyTraits> i(outf);
     37         assert(outf.good());
     38     }
     39 }