aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-01-19 13:59:16 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-08 20:49:08 +0300
commitb6ebda4aad5b007d5cd6942e6c5a2795a881020c (patch)
tree69280ffc8b8e22175b30b25728fb12676c543ac2
parent4d30878d8efb86fd110c3693024db5da7aceb776 (diff)
Add support for argument optional type for process high-level API
-rw-r--r--libbutl/process.mxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/libbutl/process.mxx b/libbutl/process.mxx
index 4faa808..39a5d92 100644
--- a/libbutl/process.mxx
+++ b/libbutl/process.mxx
@@ -487,7 +487,7 @@ LIBBUTL_MODEXPORT namespace butl
// The A arguments can be anything convertible to const char* via the
// overloaded process_arg_as() (see below). Out of the box you can use const
// char*, std::string, path/dir_path, (as well as [small_]vector[_view] of
- // these), and numeric types.
+ // these), and numeric types (as well as optional<T> of all the above).
//
struct process_env
{
@@ -660,6 +660,14 @@ LIBBUTL_MODEXPORT namespace butl
v.push_back (process_arg_as (x, storage));
}
+ template <typename V, typename T>
+ inline void
+ process_args_as (V& v, const optional<T>& x, std::string& storage)
+ {
+ if (x)
+ process_args_as (v, *x, storage);
+ }
+
// [small_]vector[_view]<>
//
template <typename V>