Gernot Frisch wrote:
> Hi,
>
>
> can I somehow do something like this:
>
> void foo(int*)
> {}
>
> int main()
> {
> foo( {1,2,3,4} );
> return 0;
> }
>
Not in the current standard. You will have to do some workarounds other
people have suggested. Seems to me it is very likely that C++0x will get
this right finally, but that's like, what, 5 more years from now?
You can overload operators like << and , (comma) to get something
similar. But for many cases this seems like an overkill and as for me
I'll just stick to
int temp[] = {1,2,3,4};f
foo(temp);
Regards,
Ben
|