...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::process::v2::bound_launcher — Utility class to bind initializers to a launcher.
// In header: <boost/process/v2/bind_launcher.hpp> template<typename Launcher, typename ... Init> struct bound_launcher { // public member functions template<typename Launcher_, typename ... Init_> bound_launcher(Launcher_ &&, Init_ &&...); template<typename ExecutionContext, typename Args, typename ... Inits> auto operator()(ExecutionContext &, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type &, Args &&, Inits &&...); template<typename ExecutionContext, typename Args, typename ... Inits> auto operator()(ExecutionContext &, error_code &, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type &, Args &&, Inits &&...); template<typename Executor, typename Args, typename ... Inits> auto operator()(Executor, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type &, Args &&, Inits &&...); template<typename Executor, typename Args, typename ... Inits> auto operator()(Executor, error_code &, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type &, Args &&, Inits &&...); // private member functions template<std::size_t ... Idx, typename ExecutionContext, typename Args, typename ... Inits> auto invoke(unspecified, ExecutionContext &, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type &, Args &&, Inits &&...); template<std::size_t ... Idx, typename ExecutionContext, typename Args, typename ... Inits> auto invoke(unspecified, ExecutionContext &, error_code &, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type &, Args &&, Inits &&...); template<std::size_t ... Idx, typename Executor, typename Args, typename ... Inits> auto invoke(unspecified, Executor, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type &, Args &&, Inits &&...); template<std::size_t ... Idx, typename Executor, typename Args, typename ... Inits> auto invoke(unspecified, Executor, error_code &, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type &, Args &&, Inits &&...); };
This can be used when multiple processes shared some settings, e.g.
bound_launcher
public member functionstemplate<typename Launcher_, typename ... Init_> bound_launcher(Launcher_ && l, Init_ &&... init);
template<typename ExecutionContext, typename Args, typename ... Inits> auto operator()(ExecutionContext & context, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
template<typename ExecutionContext, typename Args, typename ... Inits> auto operator()(ExecutionContext & context, error_code & ec, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
template<typename Executor, typename Args, typename ... Inits> auto operator()(Executor exec, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
template<typename Executor, typename Args, typename ... Inits> auto operator()(Executor exec, error_code & ec, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
bound_launcher
private member functionstemplate<std::size_t ... Idx, typename ExecutionContext, typename Args, typename ... Inits> auto invoke(unspecified, ExecutionContext & context, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
template<std::size_t ... Idx, typename ExecutionContext, typename Args, typename ... Inits> auto invoke(unspecified, ExecutionContext & context, error_code & ec, const typename std::enable_if< std::is_convertible< ExecutionContext &, net::execution_context & >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
template<std::size_t ... Idx, typename Executor, typename Args, typename ... Inits> auto invoke(unspecified, Executor exec, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);
template<std::size_t ... Idx, typename Executor, typename Args, typename ... Inits> auto invoke(unspecified, Executor exec, error_code & ec, const typename std::enable_if< net::execution::is_executor< Executor >::value||net::is_executor< Executor >::value, filesystem::path >::type & executable, Args && args, Inits &&... inits);