[Boost-bugs] [Boost C++ Libraries] #1936: Make basic_path more generic?

Subject: [Boost-bugs] [Boost C++ Libraries] #1936: Make basic_path more generic?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-05-20 13:02:34


#1936: Make basic_path more generic?
------------------------------+---------------------------------------------
 Reporter: bemandawes | Owner: bemandawes
     Type: Feature Requests | Status: new
Milestone: Boost 1.36.0 | Component: None
  Version: Boost 1.35.0 | Severity: Not Applicable
 Keywords: |
------------------------------+---------------------------------------------
 in several places I need to have code which works both with char and
 wchar_t. Those are template functions. I also work with paths there so I
 wanted to actually write something like

 template <typename CharType>
 void foo(const std::basic_string<CharType>& s)
 {
      typedef fs::basic_path<std::basic_string<CharType> > path_type;
      ...
 }

 but it turned out that I can't do it because 1) basic_path has the
 second Traits template parameter mandatory and 2) this Traits parameter
 has actually different type for path and wpath:

      struct path_traits;
      typedef basic_path< std::string, path_traits > path;
      // ...
      struct BOOST_FILESYSTEM_DECL wpath_traits;
      typedef basic_path< std::wstring, wpath_traits > wpath;

 Of course, I can easily workaround it with my own traits, but I wonder
 could it be in the first place like:

      template<class String>
      class basic_path_traits;

      template<class String, class Traits = basic_path_traits<String> >
      class basic_path;

 with basic_path_traits being specialized for std::string and
 std::wstring and fs::path and fs::wpath being just

      typedef basic_path< std::string > path;
      typedef basic_path< std::wstring > wpath;

 ?

 Thanks.

 -- Alexei Alexandrov

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1936>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC