On 12/12/18 16:14 +, Jonathan Wakely wrote:
+void
+test04()
+{
+ std::filesystem::path p = "/a/b/c/d/e/f/g";
+ VERIFY( std::distance(p.begin(), p.end()) == 8);
+ auto it = p.begin();
+ std::advance(it, 1);
+ VERIFY( std::distance(p.begin(), it) == 1 );
+ VERIFY( it->native() == "a" );
+
Although filesystem::path::iterator is only a bidirectional iterator,
the underlying sequence has random access iterators (specifically, raw
pointers). This means std::distance and std::advance can be implemented
more efficiently than the generic versions which apply ++ and --
repeatedly.