aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-15 00:29:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-15 00:29:07 +0200
commit0184c3182f3bdc83fd4dc6f10ed3609cca32990c (patch)
tree2d2aef0b9b5ed13bcc06518ec388f4c67a21f6a4
parent5b9b8d3dadf8471ff3a722fe714bd0900fc6c7ba (diff)
Fix bug in path::iterator postfix increment
-rw-r--r--butl/path2
-rw-r--r--tests/path/driver.cxx18
2 files changed, 10 insertions, 10 deletions
diff --git a/butl/path b/butl/path
index 5f6d063..3f0d567 100644
--- a/butl/path
+++ b/butl/path
@@ -406,7 +406,7 @@ namespace butl
}
iterator
- operator++ (int) const {iterator r (*this); return ++r;}
+ operator++ (int) {iterator r (*this); operator++(); return r;}
string_type operator* () const
{
diff --git a/tests/path/driver.cxx b/tests/path/driver.cxx
index 302968d..30933ea 100644
--- a/tests/path/driver.cxx
+++ b/tests/path/driver.cxx
@@ -130,28 +130,28 @@ main ()
{
path p ("foo");
assert (path (p.begin (), p.end ()) == p);
- assert (path (p.begin ()++, p.end ()) == path ());
+ assert (path (++p.begin (), p.end ()) == path ());
}
{
path p ("foo/bar");
assert (path (p.begin (), p.end ()) == p);
- assert (path (p.begin ()++, p.end ()) == path ("bar"));
- assert (path (p.begin (), p.begin ()++) == path ("foo"));
+ assert (path (++p.begin (), p.end ()) == path ("bar"));
+ assert (path (p.begin (), ++p.begin ()) == path ("foo"));
}
{
path p ("/foo/bar");
assert (path (p.begin (), p.end ()) == p);
- assert (path (p.begin ()++, p.end ()) == path ("foo/bar"));
- assert (path ((p.begin ()++)++, p.end ()) == path ("bar"));
- assert (path (p.begin (), p.begin ()++) == path ("/"));
- assert (path (p.begin ()++, (p.begin ()++)++) == path ("foo"));
- assert (path ((p.begin ()++)++, ((p.begin ()++)++)++) == path ("bar"));
+ assert (path (++p.begin (), p.end ()) == path ("foo/bar"));
+ assert (path (++(++p.begin ()), p.end ()) == path ("bar"));
+ assert (path (p.begin (), ++p.begin ()) == path ("/"));
+ assert (path (++p.begin (), ++(++p.begin ())) == path ("foo"));
+ assert (path (++(++p.begin ()), ++(++(++p.begin ()))) == path ("bar"));
}
#ifndef _WIN32
{
path p ("/");
assert (path (p.begin (), p.end ()) == p);
- assert (path (p.begin ()++, p.end ()) == path ());
+ assert (path (++p.begin (), p.end ()) == path ());
}
#endif