Connecting Tech Pros Worldwide Help | Site Map

indefinite number of arguments

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 27th, 2006, 02:15 AM
PengYu.UT@gmail.com
Guest
 
Posts: n/a
Default indefinite number of arguments

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, 04:45 AM
Jakob Bieling
Guest
 
Posts: n/a
Default 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, 05:05 AM
Phlip
Guest
 
Posts: n/a
Default 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, 05:15 AM
Jakob Bieling
Guest
 
Posts: n/a
Default 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)


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.