From e187af6b40020053e3420a4c35a697f487308791 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 Jul 2015 16:20:32 +0200 Subject: Add reverse iteration support to path --- butl/path | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'butl/path') 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 traits; struct iterator; + typedef std::reverse_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 -- cgit v1.1