libcxx

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

streaming.pass.cpp (2051B)


      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 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
     10 // XFAIL: *
     11 
     12 // <chrono>
     13 // class month;
     14 
     15 // template<class charT, class traits>
     16 //   basic_ostream<charT, traits>&
     17 //   operator<<(basic_ostream<charT, traits>& os, const month& m);
     18 //
     19 //   Effects: If m.ok() == true inserts format(os.getloc(), fmt, m) where fmt is "%b" widened to charT.
     20 //   Otherwise inserts int{m} << " is not a valid month".
     21 //
     22 // template<class charT, class traits>
     23 //   basic_ostream<charT, traits>&
     24 //   to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const month& m);
     25 //
     26 //   Effects: Streams m into os using the format specified by the NTCTS fmt.
     27 //   fmt encoding follows the rules specified in 25.11.
     28 //
     29 // template<class charT, class traits, class Alloc = allocator<charT>>
     30 //   basic_istream<charT, traits>&
     31 //   from_stream(basic_istream<charT, traits>& is, const charT* fmt,
     32 //             month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
     33 //             minutes* offset = nullptr);
     34 //
     35 //   Effects: Attempts to parse the input stream is into the month m using the format flags
     36 //   given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid month,
     37 //   is.setstate(ios_- base::failbit) shall be called and m shall not be modified.
     38 //   If %Z is used and successfully parsed, that value will be assigned to *abbrev if
     39 //   abbrev is non-null. If %z (or a modified variant) is used and successfully parsed,
     40 //   that value will be assigned to *offset if offset is non-null.
     41 
     42 #include <chrono>
     43 #include <type_traits>
     44 #include <cassert>
     45 #include <iostream>
     46 
     47 #include "test_macros.h"
     48 
     49 int main()
     50 {
     51    using month = std::chrono::month;
     52    std::cout << month{1};
     53 }