2

In my current code (which is based on C++11) I use the following:

class Foo
{
public:
    void Test(); 
private:
    std::wstring_convert<std::codecvt_utf8<wchar_t> > m_myconv
};

void Foo::Test()
{
    std::wstring temp = m_myconv.from_bytes( (const char *) charArray );
}

I'm converting the results of the SQLite library to the std::wstring.

I understand that with C++17, such conversion is deprecated and I will no longer be able to use this code.

Is there an alternative that I can use for all 3 major platforms: Windows, *nix and Mac?

I understand that there is a possibility of using Boost. But this is a last resort, i.e. if there is no solution with the standard library.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Igor
  • 5,620
  • 11
  • 51
  • 103
  • 3
    "*such conversion is deprecated and I will no longer be able to use this code.*" That's not what "deprecated" means. It means that the functionality can be removed under later standards, but that doesn't mean it isn't still there. – Nicol Bolas May 10 '21 at 00:33
  • 1
    Look at the second answer https://stackoverflow.com/a/43153057/6752050 – 273K May 10 '21 at 00:36
  • @S.M., did you look at the very first comment for it? – Igor May 10 '21 at 00:44
  • @NicolBolas, and I want to be prepared when it will be removed. – Igor May 10 '21 at 00:45
  • @S.M., and that accepted answer is confusing, especially since there is a second one. – Igor May 10 '21 at 00:48
  • 1
    @Igor: "*I want to be prepared when it will be removed.*" When it is removed, you will know because it will only happen when C++ has real Unicode support. – Nicol Bolas May 10 '21 at 01:33

0 Answers0