types.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===//
2//
3// ��������������������The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <locale>
11
12// template <class charT>
13// class collate_byname
14//     : public collate<charT>
15// {
16// public:
17//     typedef basic_string<charT> string_type;
18//     explicit collate_byname(const char*, size_t refs = 0);
19//     explicit collate_byname(const string&, size_t refs = 0);
20// protected:
21//     ~collate_byname();
22// };
23
24#include <locale>
25#include <string>
26#include <cassert>
27
28#include <stdio.h>
29
30int main()
31{
32    std::locale l("en_US");
33    {
34        assert(std::has_facet<std::collate_byname<char> >(l));
35        assert(&std::use_facet<std::collate<char> >(l)
36            == &std::use_facet<std::collate_byname<char> >(l));
37    }
38    {
39        assert(std::has_facet<std::collate_byname<wchar_t> >(l));
40        assert(&std::use_facet<std::collate<wchar_t> >(l)
41            == &std::use_facet<std::collate_byname<wchar_t> >(l));
42    }
43}
44