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

http://www.boost.org/doc/libs/1_37_0/doc/html/string_algo.html

or the file-system library

http://www.boost.org/doc/libs/1_37_0/libs/filesystem/doc/index.htm

> 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 hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net