aboutsummaryrefslogtreecommitdiff
path: root/libbutl/path-map.mxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-18 11:39:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-01-18 11:39:56 +0200
commite3bf8b04654d4131be6ea4be670e66827b489d2e (patch)
treec8639faa5a9da99286fe58bb28e8b15b8f5e7e43 /libbutl/path-map.mxx
parent6734ffe0dc7fbdca5bbbf57f80aa44e1fafb6922 (diff)
Move find_sup() from path_map to prefix_map and fix
Diffstat (limited to 'libbutl/path-map.mxx')
-rw-r--r--libbutl/path-map.mxx35
1 files changed, 3 insertions, 32 deletions
diff --git a/libbutl/path-map.mxx b/libbutl/path-map.mxx
index c526a89..2697a48 100644
--- a/libbutl/path-map.mxx
+++ b/libbutl/path-map.mxx
@@ -126,39 +126,10 @@ LIBBUTL_MODEXPORT namespace butl
// Note that the delimiter character is not used (is_delimiter() from
// path_traits is used instead).
//
- template <typename P, typename T>
- struct path_map_impl: prefix_map<P, T, P::traits::directory_separator>
- {
- using base = prefix_map<P, T, P::traits::directory_separator>;
- using base::base;
-
- using iterator = typename base::iterator;
- using const_iterator = typename base::const_iterator;
-
- // Find the most qualified entry that is a superpath of this path.
- //
- iterator
- find_sup (const P& p)
- {
- // Get the greatest less than, if any. We might still not be a sub. Note
- // also that we still have to check the last element if upper_bound()
- // returned end().
- //
- auto i (this->upper_bound (p));
- return i == this->begin () || !p.sub ((--i)->first) ? this->end () : i;
- }
-
- const_iterator
- find_sup (const P& p) const
- {
- auto i (this->upper_bound (p));
- return i == this->begin () || !p.sub ((--i)->first) ? this->end () : i;
- }
- };
-
template <typename T>
- using path_map = path_map_impl<path, T>;
+ using path_map = prefix_map<path, T, path::traits::directory_separator>;
template <typename T>
- using dir_path_map = path_map_impl<dir_path, T>;
+ using dir_path_map =
+ prefix_map<dir_path, T, dir_path::traits::directory_separator>;
}