Boost logo

Boost Users :

Subject: Re: [Boost-users] boost and std::wstring
From: Daniel Krügler (dsp_at_[hidden])
Date: 2008-11-28 03:38:38

Sean Farrow wrote:
> Does boost work with std::wstring?

Why not? Boost provides a bunch of function and class templates that
work for any character-like type. See e.g. the String-Algo library

or the file-system library

> Also is there a way to tell c++ to
> use std::wstring when instanciating an std::string?

This has nothing to do with C++. std::string is a typedef for
std::basic_string<char> and std::wstring is some such for
std::basic_string<wchar_t>. char and wchar_t are distinct
types, so no such instantiation replacement makes sense.

You probably come from MFC world with some TCHAR #define.
If you prefer this, just define your own tstring like this:

typedef std::basic_string<TCHAR> tstring;

and you are done (proper include's implied).

HTH & Greetings from Bremen,

Daniel Krügler

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at