aboutsummaryrefslogtreecommitdiff
path: root/butl
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-30 17:21:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-30 17:21:30 +0200
commitbc5df38d08cb0dbe5b55c145ecce93581de77fee (patch)
tree0ef2029978c0f076fdaa02ee6eac4f066fdde4ee /butl
parente37cf91f24fc409fa0aa84500245f57c685fc8ea (diff)
Make (foo / "bar") always result in path and not dir_path
Diffstat (limited to 'butl')
-rw-r--r--butl/path46
1 files changed, 26 insertions, 20 deletions
diff --git a/butl/path b/butl/path
index 8148b00..d5b4407 100644
--- a/butl/path
+++ b/butl/path
@@ -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;