summaryrefslogtreecommitdiffstats
path: root/test/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
blob: 8a70fea47579dde7dec47f6f5118af9647f5ac30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <locale>

// template <>
// class codecvt<wchar_t, char, mbstate_t>
//     : public locale::facet,
//       public codecvt_base
// {
// public: 
//     typedef wchar_t   intern_type; 
//     typedef char      extern_type; 
//     typedef mbstate_t state_type; 
//     ...
// };

#include <locale>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
    static_assert((std::is_same<F::intern_type, wchar_t>::value), "");
    static_assert((std::is_same<F::extern_type, char>::value), "");
    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
    std::locale l = std::locale::classic();
    assert(std::has_facet<F>(l));
    const F& f = std::use_facet<F>(l);
    (void)F::id;
}