Topic: Instantiating function templates


Author: "Peter Dimov" <pdimov@mmltd.net>
Date: 2000/06/26
Raw View
Scott Robert Ladd <sladd@tampabay.rr.com> wrote in message
news:cU255.14336$ez6.58996@typhoon.tampabay.rr.com...
> Hi,
>
> I have a piece of code that *I* believe conforms to Standard C++ -- but it
> doesn't work, so either my compiler is confused, or I am. The problem is
> demonstrated by the following program:
>
> #include <string>
> #include <iostream>
> #include <iomanip>
>
> using namespace std;
>
> template <class T> void showType()
> {
>     cout << typeid(T).name() << endl;
> };

[...]

Are you using MSVC? This is a well known bug. Use

template <class T> void showType(T * = 0);

--
Peter Dimov
Multi Media Ltd.


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]