Using boost::filesystem with TCHAR

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? 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

On Tue, Nov 25, 2008 at 6:48 AM, Rob Caldecott <robert.caldecott@gmail.com> 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
participants (2)
-
Beman Dawes
-
Rob Caldecott