How to pass a temporary array to a function in standard C++17
问题 I have a function of the following signature: void foo(int argc, char const * const argv[]); I would like to call it in a concise way, similar, but not necessary identical as below: foo(3, {"one", "two", "three"}); I know that C supports compound literals just for this purpose (reference). I also know how to solve the problem using templates (reference). However, my problem is slightly different. The function signature is fixed - it normally takes arguments passed to main and the size of the