Tuesday 15 March 2011

c++ - sending parameters to a function in cpp -



c++ - sending parameters to a function in cpp -

is possible have phone call function this:

test({22,11});

and decode parameter (and type) in function declaration? example:

void test(int *a){...}

i don't know mean "decode parameter", can certanly have test({22,11});.

#include <initializer_list> void test( std::initializer_list<int> params ) { (int : params) std::cout << << ' '; }

c++ function

No comments:

Post a Comment