Connecting Tech Pros Worldwide Help | Site Map

indefinite number of arguments

  #1  
Old March 27th, 2006, 03:15 AM
PengYu.UT@gmail.com
Guest
 
Posts: n/a
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

  #2  
Old March 27th, 2006, 05:45 AM
Jakob Bieling
Guest
 
Posts: n/a

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)


  #3  
Old March 27th, 2006, 06:05 AM
Phlip
Guest
 
Posts: n/a

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!!!


  #4  
Old March 27th, 2006, 06:15 AM
Jakob Bieling
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding to a BODY-onload function from within the page laredotornado@zipmail.com answers 2 September 12th, 2005 12:35 AM
Browser Height in IE? NOT document height Kepler answers 12 July 23rd, 2005 02:48 PM
Eventhandling, preserving Scope with Closures? Marc Tanner answers 4 July 23rd, 2005 12:58 PM