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<char, char, mbstate_t>
14 //     : public locale::facet,
15 //       public codecvt_base
16 // {
17 // public:
18 //     typedef char      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     typedef std::codecvt<char, char, std::mbstate_t> F;
31     static_assert((std::is_base_of<std::locale::facet, F>::value), "");
32     static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
33     static_assert((std::is_same<F::intern_type, char>::value), "");
34     static_assert((std::is_same<F::extern_type, char>::value), "");
35     static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
36     std::locale l = std::locale::classic();
37     assert(std::has_facet<F>(l));
38     const F& f = std::use_facet<F>(l);
39     (void)F::id;
40 }
41