Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > indefinite number of arguments

Reply
Thread Tools

indefinite number of arguments

 
 
PengYu.UT@gmail.com
Guest
Posts: n/a
 
      03-27-2006
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

 
Reply With Quote
 
 
 
 
Jakob Bieling
Guest
Posts: n/a
 
      03-27-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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?


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)


 
Reply With Quote
 
 
 
 
Phlip
Guest
Posts: n/a
 
      03-27-2006
Jakob Bieling wrote:

> With or without boost, you can only mimick ab indefinite number of
> arguments.


Could you overload operator, and then...

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

? (the ellipses are narrative)

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


 
Reply With Quote
 
Jakob Bieling
Guest
Posts: n/a
 
      03-27-2006
Phlip <(E-Mail Removed)> wrote:
> Jakob Bieling wrote:
>
>> With or without boost, you can only mimick ab indefinite number of
>> arguments.

>
> Could you overload operator, and then...
>
> foo(a1, a2, a3, ... aN);
>
> ? (the ellipses are narrative)


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

regards
--
jb

(reply address in rot13, unscramble first)


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call again a variadic function (... variable number of arguments)with same arguments that its variadic wrapper moreau.steve@gmail.com C Programming 3 12-31-2008 07:13 AM
Any support for indefinite length integer PengYu.UT@gmail.com C++ 6 03-30-2006 05:28 PM
Session timeout indefinite =?Utf-8?B?T2xlZw==?= ASP .Net 1 12-09-2005 04:13 PM
Indefinite for loop syntax question Jenny Java 5 09-16-2004 11:06 AM
Re: Structures of indefinite size Dave Thompson C Programming 0 06-26-2003 03:17 AM



Advertisments