summaryrefslogtreecommitdiffstats
path: root/test/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
blob: bf0277fb1265ba9b7fc716978f6d46281b9e14b0 (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
41
42
43
44
45
46
47
48
49
//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <locale>

// template <class charT> 
// class collate
//     : public locale::facet { 
// public: 
//     typedef charT char_type; 
//     typedef basic_string<charT>string_type;
// 
//     static locale::id id;
// };

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

int main()
{
    std::locale l = std::locale::classic();
    {
        assert(std::has_facet<std::collate<char> >(l));
        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
        {
            (void)std::collate<char>::id;
        }
        static_assert((std::is_same<std::collate<char>::char_type, char>::value), "");
        static_assert((std::is_same<std::collate<char>::string_type, std::string>::value), "");
        static_assert((std::is_base_of<std::locale::facet, std::collate<char> >::value), "");
    }
    {
        assert(std::has_facet<std::collate<wchar_t> >(l));
        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
        {
            (void)std::collate<wchar_t>::id;
        }
        static_assert((std::is_same<std::collate<wchar_t>::char_type, wchar_t>::value), "");
        static_assert((std::is_same<std::collate<wchar_t>::string_type, std::wstring>::value), "");
        static_assert((std::is_base_of<std::locale::facet, std::collate<wchar_t> >::value), "");
    }
}