Possibility to avoid {} in initializer_list instances.

Is there any possible way to avoid the curly brackets in the following call?
  void funct(initializer_list<int> args){/*...*/}
  int main(){
     funct( {1,2,3} );   //<--This line

I tried searching it up but got nowhere fast.

On a random note, I like the new "New Topic" box with the "Write your question here" and the automatic code tags. :3
AFAIK there isn't. By definition initializer_lists are wrapped in braces.

Ah! Just noticing they put that in there as well. That's going to help a lot :P
Why do you want to avoid using the curly braces? The items would then be interpreted as individual parameters, and you could just use a vararg function to handle that situation, but your current code is much cleaner.
Oh, well thank you anyway. I am worried about my team members using my function without the brackets because they won't expect an initializer_list... Even I'm worried about forgetting that I need the brackets and start using the function blindly.
A braced-init-list is required.

Except that we can pass an empty initializer list with
funct( std::initializer_list<int>() ) ;
Daleth wrote:
I'm worried about forgetting that I need the brackets
Fear not. If you forget the brackets the compiler will tell you very clearly that you have made that mistake, then you can correct it swiftly.
Topic archived. No new replies allowed.