aboutsummaryrefslogtreecommitdiff
path: root/libbutl/default-options.mxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-08-05 11:20:30 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-08-05 12:14:19 +0300
commit1cdb233cedd12069a4aa5d761e20b42e842ec58f (patch)
tree9f8a50e9e6876f5cd03eb662db949d7b7a67eeb2 /libbutl/default-options.mxx
parent060bb0b8ca44affa817600f21caa33cf54d5ecad (diff)
Convert default_options_start() to template function which accepts iterators range
Diffstat (limited to 'libbutl/default-options.mxx')
-rw-r--r--libbutl/default-options.mxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/libbutl/default-options.mxx b/libbutl/default-options.mxx
index 11f7bb2..2d44333 100644
--- a/libbutl/default-options.mxx
+++ b/libbutl/default-options.mxx
@@ -152,12 +152,25 @@ LIBBUTL_MODEXPORT namespace butl
AS
merge_default_arguments (const default_options<O>&, const AS&, F&&);
- // Find a common start (parent) directory stopping at home or root
- // (excluding).
+ // Find a common start (parent) directory for directories specified as an
+ // iterator range, stopping at home or root (excluding). Optionally pass a
+ // function resolving an iterator into a directory in a way other than just
+ // dereferencing it. The function signature is:
//
- LIBBUTL_SYMEXPORT optional<dir_path>
- default_options_start (const optional<dir_path>& home_dir,
- const std::vector<dir_path>&);
+ // const dir_path& (I)
+ //
+ template <typename I, typename F>
+ optional<dir_path>
+ default_options_start (const optional<dir_path>& home, I, I, F&&);
+
+ template <typename I>
+ inline optional<dir_path>
+ default_options_start (const optional<dir_path>& home, I b, I e)
+ {
+ return default_options_start (home,
+ b, e,
+ [] (I i) -> const dir_path& {return *i;});
+ }
}
#include <libbutl/default-options.ixx>