Boost logo

Boost :

From: Martin (adrianm_at_[hidden])
Date: 2005-07-13 13:56:43


> Since boost::filesystem::basic_path is trying to stay in sync with
> std::basic_string, I'd like to at least consider all the overloads for
> operations provided by std::basic_string.

Don't understand what you mean.

The String is just the internal storage type in the path, similar to
char/wchar for basic_string. basic_string doesn't have an interface using the
internal storage except c-strings "const char*".

I think the path interface should always have a basic_string interface
regardless of the internal storage type.

One solution could be to have a second template argument which specifies the
interface type.

template <class StorageStringT, class InterfaceStringT = basic_string<typename
StorageStringT::value_type> >
class path {
  path(const InterfaceStringT& str) { append(str.begin(), str.end()); }
  InterfaceStringT file_string() const { ... }
  const StorageStringT& string() const { return m_path; }
...
};

> Anyhow, the consistent (and sensible) set for path would be:
>
> const path &
> const string &
> const char *
> InputIterator, InputIterator

The last one could be confusing since on a path you iterate over path elements
and not characters.

string s("/abc/def");
path p1(s.begin(), s.end());
path p2(p1.begin(), p1.end()); // should this work?


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