transform.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
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> 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 21int main() 22{ 23 std::locale l = std::locale::classic(); 24 { 25 std::string x("1234"); 26 const std::collate<char>& f = std::use_facet<std::collate<char> >(l); 27 assert(f.transform(x.data(), x.data() + x.size()) == x); 28 } 29 { 30 std::wstring x(L"1234"); 31 const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l); 32 assert(f.transform(x.data(), x.data() + x.size()) == x); 33 } 34} 35