diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-30 17:21:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-30 17:21:30 +0200 |
commit | bc5df38d08cb0dbe5b55c145ecce93581de77fee (patch) | |
tree | 0ef2029978c0f076fdaa02ee6eac4f066fdde4ee /butl/path | |
parent | e37cf91f24fc409fa0aa84500245f57c685fc8ea (diff) |
Make (foo / "bar") always result in path and not dir_path
Diffstat (limited to 'butl/path')
-rw-r--r-- | butl/path | 46 |
1 files changed, 26 insertions, 20 deletions
@@ -872,24 +872,6 @@ namespace butl template <typename C, typename K> inline basic_path<C, K> - operator/ (const basic_path<C, K>& x, const std::basic_string<C>& y) - { - basic_path<C, K> r (x); - r /= y; - return r; - } - - template <typename C, typename K> - inline basic_path<C, K> - operator/ (const basic_path<C, K>& x, const C* y) - { - basic_path<C, K> r (x); - r /= y; - return r; - } - - template <typename C, typename K> - inline basic_path<C, K> operator+ (const basic_path<C, K>& x, const std::basic_string<C>& y) { basic_path<C, K> r (x); @@ -940,8 +922,32 @@ namespace butl // template <typename C> inline basic_path<C, any_path_kind<C>> - operator/ (basic_path<C, dir_path_kind<C>> const& x, - basic_path<C, any_path_kind<C>> const& y) + operator/ (const basic_path<C, dir_path_kind<C>>& x, + const basic_path<C, any_path_kind<C>>& y) + { + basic_path<C, any_path_kind<C>> r (x); + r /= y; + return r; + } + + + // Note that the result of (foo / "bar") is always a path, even if foo + // is dir_path. An idiom to force it dir_path is this: + // + // dir_path foo_bar (dir_path (foo) /= "bar"); + // + template <typename C, typename K> + inline basic_path<C, any_path_kind<C>> + operator/ (const basic_path<C, K>& x, const std::basic_string<C>& y) + { + basic_path<C, any_path_kind<C>> r (x); + r /= y; + return r; + } + + template <typename C, typename K> + inline basic_path<C, any_path_kind<C>> + operator/ (const basic_path<C, K>& x, const C* y) { basic_path<C, any_path_kind<C>> r (x); r /= y; |