aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-17 16:20:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-17 16:20:32 +0200
commite187af6b40020053e3420a4c35a697f487308791 (patch)
tree72ecfbe49ff60e0c92111721955c5459486b66fa
parent86a1e204d5b7e93ec42696afc0b8725d2c37ca54 (diff)
Add reverse iteration support to path
-rw-r--r--butl/path7
1 files changed, 7 insertions, 0 deletions
diff --git a/butl/path b/butl/path
index 62cadad..db77563 100644
--- a/butl/path
+++ b/butl/path
@@ -236,6 +236,7 @@ namespace butl
typedef path_traits<C> traits;
struct iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
// Construct special empty path. Note that we have to provide our
// own implementation rather than using '=default' to make clang
@@ -263,6 +264,9 @@ namespace butl
//
basic_path (const iterator& begin, const iterator& end);
+ basic_path (const reverse_iterator& rbegin, const reverse_iterator& rend)
+ : basic_path (end.base (), begin.base ()) {}
+
void
swap (basic_path& p)
{
@@ -436,6 +440,9 @@ namespace butl
iterator begin () const;
iterator end () const;
+ reverse_iterator rbegin () const {return reverse_iterator (end ());}
+ reverse_iterator rend () const {return reverse_iterator (begin ());}
+
public:
// Normalize the path. This includes collapsing the '.' and '..'
// directories if possible, collapsing multiple directory