Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2002-09-08 11:31:45


Gennadiy,

On Sunday 08 September 2002 01:35, Gennadiy Rozental wrote:
> 9. Function templates like: template<class T> inline T pi_lower() does not
> work at least on MSVC. Use class specializations instead.
>
> I know that function templates like
> template<typename T>
> void foo() {
> ...
> }
> produces wrong specialization with MSVC.

FWIW, the correct specialization gets instantiated and compiled. It is
actually a name mangling problem. With vc6 name mangling the template
arguments are not part of the mangled name. As a result the linker can not
differentiate between foo<int>() and foo<double>(). The usual workaround is
to do something like this.

template <class T>
void
foo(T* = 0) {}

--Thomas

-- 
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
http://www.ive.uni-hannover.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk