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 <class charT> 13 // class collate 14 // : public locale::facet { 15 // public: 16 // typedef charT char_type; 17 // typedef basic_string<charT>string_type; 18 // 19 // static locale::id id; 20 // }; 21 22 #include <locale> 23 #include <type_traits> 24 #include <cassert> 25 26 int main() 27 { 28 std::locale l = std::locale::classic(); 29 { 30 assert(std::has_facet<std::collate<char> >(l)); 31 const std::collate<char>& f = std::use_facet<std::collate<char> >(l); 32 { 33 (void)std::collate<char>::id; 34 } 35 static_assert((std::is_same<std::collate<char>::char_type, char>::value), ""); 36 static_assert((std::is_same<std::collate<char>::string_type, std::string>::value), ""); 37 static_assert((std::is_base_of<std::locale::facet, std::collate<char> >::value), ""); 38 } 39 { 40 assert(std::has_facet<std::collate<wchar_t> >(l)); 41 const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l); 42 { 43 (void)std::collate<wchar_t>::id; 44 } 45 static_assert((std::is_same<std::collate<wchar_t>::char_type, wchar_t>::value), ""); 46 static_assert((std::is_same<std::collate<wchar_t>::string_type, std::wstring>::value), ""); 47 static_assert((std::is_base_of<std::locale::facet, std::collate<wchar_t> >::value), ""); 48 } 49 } 50