Boost logo

Boost :

Subject: Re: [boost] Using boost::filesystem with TCHAR
From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-11-25 10:51:07


On Tue, Nov 25, 2008 at 6:48 AM, Rob Caldecott
<robert.caldecott_at_[hidden]> wrote:
> I wish to use the boost::filesystem library with some Windows apps and want to
> define TCHAR-friendly types. I *think* the following code should do the trick,
> giving me a boost::filesystem::tpath type, but is there anything I've missed?

Off the top of my head, it looks OK.

Have you tried it?

--Beman

>
>
> tpath.hpp
>
> #include <boost/filesystem.hpp>
>
> namespace boost {
> namespace filesystem {
>
> struct tpath_traits;
> typedef basic_path<std::basic_string<TCHAR>, tpath_traits> tpath;
>
> struct tpath_traits
> {
> typedef std::basic_string<TCHAR> internal_string_type;
> typedef std::basic_string<TCHAR> external_string_type;
> static external_string_type to_external( const tpath &,
> const internal_string_type & src ) { return src; }
> static internal_string_type to_internal(
> const external_string_type & src ) { return src; }
> };
>
> } // filesystem
> } // boost
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk