472,353 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

template list prameter

Does that just not compile with vc++?
I found this in "template complete" and asked myself if this is just a
nice feature of some compilers, or if it is standard?

I can't install other compilers!

###########
#include <iostream>

template <typename T> inline
T const& max (T const& a, T const& b)
{
return a < b ? b : a;
}

template <typename T, ... list> inline
T const& max (T const& a, T const& b, list const& x)
{
return max (a, max(b,x));
}

int main(int argc, char* argv[])
{
std::cout << max<double>(1.0, 3.0 ,4.0 ,8.0 ,0.0) << std::endl;
system("PAUSE");
return 0;
}

Feb 14 '06 #1
1 1258
eiji wrote:
Does that just not compile with vc++?
I found this in "template complete" and asked myself if this is just a
nice feature of some compilers, or if it is standard?
It's non-standard, AFAICT.

To add, I've never seen anything like this.

I can't install other compilers!

###########
#include <iostream>

template <typename T> inline
T const& max (T const& a, T const& b)
{
return a < b ? b : a;
}

template <typename T, ... list> inline
T const& max (T const& a, T const& b, list const& x)
{
return max (a, max(b,x));
}

int main(int argc, char* argv[])
{
std::cout << max<double>(1.0, 3.0 ,4.0 ,8.0 ,0.0) << std::endl;
system("PAUSE");
return 0;
}


V
--
Please remove capital As from my address when replying by mail
Feb 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gandu | last post by:
Could some C++ guru please help me? I have a very odd problem with respect templates and inheritance. I have templatized List class, from which I am...
4
by: Mat DeLong | last post by:
I have never been stuck on programming something before to the point I give up... this is a first. I am programming what should be something very...
1
by: darkstorm | last post by:
Please check this program...When I compiles it in VC.net, it gives the following error: =============== Common\Lib\PList.h(115): error C2440: '='...
11
by: cyberdave | last post by:
Someone please help me! I have a template class like this: -------------------------------------------------- template<typename T> class...
8
by: Plissken.s | last post by:
I have a template function which print out the content of a list: The following compiles: void PrintInt2 (int i) { cout << i << " "; } ...
2
by: Greg Buchholz | last post by:
/* I've been experimenting with some generic/polytypic programs, and I've stumbled on to a problem that I can't quite figure out. In the program...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted...
8
by: Konstantin | last post by:
I have two possible implementations of my class: template <typename T> class MyContainer { public: typedef typename...
7
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.