1e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier//===----------------------------------------------------------------------===// 2e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// 3e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// The LLVM Compiler Infrastructure 4e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// 5e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// This file is dual licensed under the MIT and the University of Illinois Open 6e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// Source Licenses. See LICENSE.TXT for details. 7e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// 8e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier//===----------------------------------------------------------------------===// 9e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier 107a317cec51aac7522b5959ee82e48171ad7cf011Eric Fiselier// UNSUPPORTED: c++98, c++03 117a317cec51aac7522b5959ee82e48171ad7cf011Eric Fiselier 12e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// <locale> 13e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier 14e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc> 15e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier 16e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier// wstring_convert(wstring_convert&& other); // EXTENSION 17e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier 18e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier#include <locale> 19e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier#include <codecvt> 20e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier#include <cassert> 21e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier 22e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselierint main() 23e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier{ 24e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier typedef std::codecvt_utf8<wchar_t> Codecvt; 25e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier typedef std::wstring_convert<Codecvt> Myconv; 26e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier // create a converter and perform some conversions to generate some 27e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier // interesting state. 28e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier Myconv myconv; 29e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier myconv.from_bytes("\xF1\x80\x80\x83"); 309d2fd1f556a55f17ded674e1a7e3f5ba17188a87Eric Fiselier const auto old_converted = myconv.converted(); 31e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier assert(myconv.converted() == 4); 32e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier // move construct a new converter and make sure the state is the same. 33e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier Myconv myconv2(std::move(myconv)); 340e5ebbc77c3c2cfd7d835fcfe40fcb65df0c5598Eric Fiselier assert(myconv2.converted() == old_converted); 35e7aabbb6c6348cc5d7b68f2951b66df70cadb8acEric Fiselier} 36