Home | History | Annotate | Download | only in locale.codecvt
      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 // <locale>
     11 
     12 // template <>
     13 // class codecvt<char16_t, char, mbstate_t>
     14 //     : public locale::facet,
     15 //       public codecvt_base
     16 // {
     17 // public:
     18 //     typedef char16_t  intern_type;
     19 //     typedef char      extern_type;
     20 //     typedef mbstate_t state_type;
     21 //     ...
     22 // };
     23 
     24 #include <locale>
     25 #include <type_traits>
     26 #include <cassert>
     27 
     28 int main()
     29 {
     30 //#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
     31     typedef std::codecvt<char16_t, char, std::mbstate_t> F;
     32     static_assert((std::is_base_of<std::locale::facet, F>::value), "");
     33     static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
     34     static_assert((std::is_same<F::intern_type, char16_t>::value), "");
     35     static_assert((std::is_same<F::extern_type, char>::value), "");
     36     static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
     37     std::locale l = std::locale::classic();
     38     assert(std::has_facet<F>(l));
     39     const F& f = std::use_facet<F>(l);
     40     (void)F::id;
     41 //#endif
     42 }
     43