
25 Jan
2013
25 Jan
'13
7:53 p.m.
On 01/25/2013 08:30 AM, Beman Dawes wrote:
Not particularly elegant, but this does work:
path x("/foo/bar"); path y("/foo/baar");
auto result = std::mismatch(x.begin(), x.end(), y.begin());
path prefix; for (auto itr = x.begin(); itr != result.first; ++itr) prefix /= *itr;
I believe this last bit is just std::accumulate with std::divides<path>. Whether that better expresses intent is another matter. Eric