From 1cdb233cedd12069a4aa5d761e20b42e842ec58f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 5 Aug 2021 11:20:30 +0300 Subject: Convert default_options_start() to template function which accepts iterators range --- libbutl/default-options.mxx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'libbutl/default-options.mxx') 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&, 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 - default_options_start (const optional& home_dir, - const std::vector&); + // const dir_path& (I) + // + template + optional + default_options_start (const optional& home, I, I, F&&); + + template + inline optional + default_options_start (const optional& home, I b, I e) + { + return default_options_start (home, + b, e, + [] (I i) -> const dir_path& {return *i;}); + } } #include -- cgit v1.1