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> class collate; 13 14 // string_type transform(const charT* low, const charT* high) const; 15 16 #include <locale> 17 #include <string> 18 #include <cassert> 19 20 int main() 21 { 22 std::locale l = std::locale::classic(); 23 { 24 std::string x("1234"); 25 const std::collate<char>& f = std::use_facet<std::collate<char> >(l); 26 assert(f.transform(x.data(), x.data() + x.size()) == x); 27 } 28 { 29 std::wstring x(L"1234"); 30 const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l); 31 assert(f.transform(x.data(), x.data() + x.size()) == x); 32 } 33 } 34