It's making an object of type "shell" with true as a constructor argument. But I believe it works like named parameters in that you could use any combination of parameters in any order. This works by making sp::call a variadic template, with the parameter "parsing" happening at compile time based on the types of these wrapper objects.
Oh neat. Also thanks for reducing the use to a 'small' example.
Why does the author use a struct and "shell{true}" rather than creating a function or a class that would allow "shell(true)". Love for braces? Performance?
EDIT: also I wonder whether there's a way to create helper definitions to allow defining named parameters like this in a more concise way. This recursive template expansion business tends to result in long code.
Ok, so it seems the use of braces (use of "Uniform initialization syntax") in constructors is to reduce the ambiguity with declaring functions and declaring+initializing variables. This wiki entry has more:
Note: there is no need to use the shell or even to use the external processs in this case.
The example shows the usability issue in the API. Newly designed C++ API shouldn't copy such errors (if it has the same behavior). A list argument with shell=True should be rejected.
execute() launch a process with popen() and returns the captured steam as a string.
About capture of stderr with fork(), I like the way it's done in Node.js: https://nodejs.org/api/child_process.html
shell: https://github.com/vmorgulys/sandbox/blob/master/stackcity/s...
pfile: https://github.com/vmorgulys/sandbox/blob/master/stackcity/s...