Home | History | Annotate | Download | only in quoted.manip
      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 // <iomanip>
     11 
     12 // quoted
     13 
     14 #include <iomanip>
     15 #include <sstream>
     16 #include <string>
     17 #include <cassert>
     18 
     19 #include "test_macros.h"
     20 
     21 #if TEST_STD_VER > 11
     22 
     23 //  Test that mismatches in the traits between the quoted object and the dest string are diagnosed.
     24 
     25 template <class charT>
     26 struct test_traits
     27 {
     28     typedef charT     char_type;
     29 };
     30 
     31 void round_trip ( const char *p ) {
     32     std::stringstream ss;
     33     ss << std::quoted(p);
     34     std::basic_string<char, test_traits<char>> s;
     35     ss >> std::quoted(s);
     36     }
     37 
     38 
     39 
     40 int main()
     41 {
     42     round_trip ( "Hi Mom" );
     43 }
     44 #else
     45 #error
     46 #endif
     47