|
Boost : |
From: David Bergman (davidb_at_[hidden])
Date: 2002-09-09 20:55:53
Thomas,
So what input is provided to the MSVC name mangling if not the template
arguments? Not much of a mangling, since there is then not many items to
mangle into one name...
A bit odd, I find it hard to believe it is that simple.
/David
-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of Thomas Witt
Sent: Sunday, September 08, 2002 12:32 PM
To: boost_at_[hidden]
Subject: Re: [boost] Interval Library review
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 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk