is there any way to use intializer list without {}?
for example use this
Code:
foo(1, 2, 3, 4, 5, 6, 7, 8, 9 );
instead of
Code:
foo({1, 2, 3, 4, 5, 6, 7, 8, 9 });
You can do it using variadic templates as shown by Elkvis. But why do you reject the bracer syntax so much?
Last edited by Elysia; 12-11-2012 at 03:11 PM.
Originally Posted by Adak
io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
Originally Posted by Salem
You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.
Outside of your DOS world, your header file is meaningless.
I don't reject it. I just don't think it's the right tool for the job in a sprintf() function, particularly when the OP clearly shows it being used for string and numeric types.
I don't reject it. I just don't think it's the right tool for the job in a sprintf() function, particularly when the OP clearly shows it being used for string and numeric types.
I mean why
Also, I was aiming for the OP, not you. You clearly know when initializer list is good for the job, and when it isn't. But the OP seem to just reject it purely out of a syntactical view.
Originally Posted by Adak
io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
Originally Posted by Salem
You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.
Outside of your DOS world, your header file is meaningless.