1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // REQUIRES: locale.en_US.UTF-8
11 // REQUIRES: locale.fr_CA.ISO8859-1
15 // template <class charT> class ctype_byname;
17 // const charT* narrow(const charT* low, const charT*, char dfault, char* to) const;
24 #include "platform_support.h" // locale name macros
29 std::locale l(LOCALE_fr_CA_ISO8859_1);
31 typedef std::ctype<wchar_t> F;
32 const F& f = std::use_facet<F>(l);
33 std::wstring in(L" A\x07.a1\xDA");
34 std::vector<char> v(in.size());
36 assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
39 assert(v[2] == '\x07');
43 assert(v[6] == '\xDA');
47 std::locale l(LOCALE_en_US_UTF_8);
49 typedef std::ctype<wchar_t> F;
50 const F& f = std::use_facet<F>(l);
51 std::wstring in(L" A\x07.a1\xDA");
52 std::vector<char> v(in.size());
54 assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
57 assert(v[2] == '\x07');