Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-02-01 11:47:41


Beman Dawes wrote:
> Equality
> --------
>
> The path relational operators will be defined purely in terms of
> string comparison between the textual representation of the two
> paths. There are two ways to do this: (1) string comparison using
> std::string relational operators or (2) string comparison using
> std::lexicographical_compare.

I'm not not entirely sure that I understand you correctly but I think that
you mean

    p.string() < q.string()

vs

    lexicographical_compare( p.begin(), p.end(), q.begin(), q.end() )

(equivalent to p.m_name < q.m_name).

There are two reasons to prefer lexicographical_compare. First, container
requirements. Second, consider the case where p is { "first/", "second" }
and q is { "first", "/second" }.


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