I don't understand functions that accept a variable number of arguments. I want to make a program with a max function taking any number of type double and returns the greatest of them
jray344 0 Newbie Poster
Recommended Answers
Jump to Postsee this thread that was posted only a couple hours ago.
Jump to Post> I want to make a program with a max function taking any number of type double and returns the greatest of them
for a small number of arguments (upto about seven or so), you could use overloaded function names.
And just how would that help the OP create a …
Jump to Post> just how would that help the OP create a function that takes a variable number of arguments
you can call max with anything between 2 to 8 arguments; that is a variable number in my book. .But a very poor implementation because you had to create a template …
Jump to Postno. i really meant even without gcc 4.3
i would use something like a std::vector< boost::any >
or a std::list< boost::variant<int,double,std::string> >
both of which are typesafe. and i would get the same functionality.
i also would not write functions that took several dozens of arguments; so even the overloaded …
All 16 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Salem 5,265 Posting Sage
vijayan121 1,152 Posting Virtuoso
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

iamthwee
vijayan121 1,152 Posting Virtuoso
vijayan121 1,152 Posting Virtuoso
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
vijayan121 1,152 Posting Virtuoso
vijayan121 1,152 Posting Virtuoso
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
vijayan121 1,152 Posting Virtuoso
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
vijayan121 1,152 Posting Virtuoso
Ancient Dragon commented: great solution +20
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
jray344 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.