From b6ebda4aad5b007d5cd6942e6c5a2795a881020c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 19 Jan 2018 13:59:16 +0300 Subject: Add support for argument optional type for process high-level API --- libbutl/process.mxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libbutl/process.mxx') 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 of all the above). // struct process_env { @@ -660,6 +660,14 @@ LIBBUTL_MODEXPORT namespace butl v.push_back (process_arg_as (x, storage)); } + template + inline void + process_args_as (V& v, const optional& x, std::string& storage) + { + if (x) + process_args_as (v, *x, storage); + } + // [small_]vector[_view]<> // template -- cgit v1.1