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 // wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
13 
14 // size_t converted() const;
15 
16 #include <locale>
17 #include <codecvt>
18 #include <cassert>
19 
main()20 int main()
21 {
22     typedef std::codecvt_utf8<wchar_t> Codecvt;
23     typedef std::wstring_convert<Codecvt> Myconv;
24     Myconv myconv;
25     assert(myconv.converted() == 0);
26     std::string bs = myconv.to_bytes(L"\x40003");
27     assert(myconv.converted() == 1);
28     bs = myconv.to_bytes(L"\x40003\x65");
29     assert(myconv.converted() == 2);
30     std::wstring ws = myconv.from_bytes("\xF1\x80\x80\x83");
31     assert(myconv.converted() == 4);
32 }
33