Connecting Tech Pros Worldwide Forums | Help | Site Map

indefinite number of arguments

PengYu.UT@gmail.com
Guest
 
Posts: n/a
#1: Mar 27 '06
I quickly searched the group.

Like the post said, it is not possible to specify indefinite number of
arguments.

http://groups.google.com/group/comp....guments&rnum=1

But I'm wonder with the help of boost, can this take be done?

Thanks,
Peng


Jakob Bieling
Guest
 
Posts: n/a
#2: Mar 27 '06

re: indefinite number of arguments


PengYu.UT@gmail.com wrote:[color=blue]
> I quickly searched the group.
>
> Like the post said, it is not possible to specify indefinite number of
> arguments.
>
> http://groups.google.com/group/comp....guments&rnum=1
>
> But I'm wonder with the help of boost, can this take be done?[/color]

With or without boost, you can only mimick ab indefinite number of
arguments. The simplest solution is passing a 'vector' of values. This
can be extended to support more than just one type and also to look more
like a function call. But then you are still really passing a fixed
number of arguments (one 'vector' for example).

So strictly speaking, if you have a true indefinite number of
arguments, you cannot possibly determine how many you really have,
without specifying that.

hth
--
jb

(reply address in rot13, unscramble first)


Phlip
Guest
 
Posts: n/a
#3: Mar 27 '06

re: indefinite number of arguments


Jakob Bieling wrote:
[color=blue]
> With or without boost, you can only mimick ab indefinite number of
> arguments.[/color]

Could you overload operator, and then...

foo(a1, a2, a3, ... aN);

? (the ellipses are narrative)

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!


Jakob Bieling
Guest
 
Posts: n/a
#4: Mar 27 '06

re: indefinite number of arguments


Phlip <phlipcpp@yahoo.com> wrote:[color=blue]
> Jakob Bieling wrote:
>[color=green]
>> With or without boost, you can only mimick ab indefinite number of
>> arguments.[/color]
>
> Could you overload operator, and then...
>
> foo(a1, a2, a3, ... aN);
>
> ? (the ellipses are narrative)[/color]

No, but you could do "foo ((a1, a2, a3, ... aN));".

regards
--
jb

(reply address in rot13, unscramble first)


Closed Thread