Boost logo

Boost :

From: Martin (adrianm_at_[hidden])
Date: 2004-03-21 06:01:08

I have used the filesystem library for some time now and I am really happy with

In the CVS I noticed that it recently added relational operators and
an "equivalent" function.

To my surprice the relational operators are implemented in a non-portable way.
It only does a lexicographical compare! In the rationale it says:

"Programmers wishing to determine if two paths are "the same" must decide if
that means "the same representation" or "resolve to the same actual file or
directory", and choose the appropriate function accordingly."

In windows the path "file.cpp" is the same as "FILE.CPP" but not in posix. So
if I write portable code I need to do add a function like

bool eq_path(const path& path1, const path& path2) {
  return path1.string() == path2.string();
  return boost::algorithm::iequals(path1.string(), path2.string());

In most of my cases the equivalent function is not an alternative since it
requires that both paths can be evaluted by the filesystem, i.e. paths must
exist and the parent of relative paths must be known.


Another minor question: Why does the "leaf()" member function return a string
and not a path?

Boost list run by bdawes at, gregod at, cpdaniel at, john at