Boost logo

Boost :

Subject: [boost] boost::filesystem request
From: Jorge Lodos Vigil (lodos_at_[hidden])
Date: 2008-10-27 07:51:50


Hi
The Traits classes for basic_path provided in the filesystem library (path_traits and wpath_traits) are good enough to be used as default values for basic_path in most cases.
However, since they are independent structs, they can not be used to instantiate a basic_path with a single String template parameter. I would like to write:

typedef basic_string<char> string_t;
typedef fs::basic_path<string_t, fs::basic_path_traits<string_t> > path_t;

Currently we are forced to write in our code something as:

template <typename String>
struct path_traits
{};

template <>
struct path_traits<std::string>
{
typedef boost::filesystem::path_traits traits_t;
};

template <>
struct path_traits<std::wstring>
{
typedef boost::filesystem::wpath_traits traits_t;
};

typedef std::basic_string<CharT> string_t;
typedef boost::filesystem::basic_path<string_t, typename path_traits<string_t>::traits_t > path_t;

I underestand it is important to emphasize that Traits classes have nothing to do with String classes in path instantiations, so my question is: Is it reasonable to ask that path traits classes provided in the library would be implemented as template specializations instead of separate classes?

Thanks in advance.
Best regards

Jorge


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