Article View: comp.std.c++
Article #3474Problem with template overloading
From: brian (b.c.) white
Date: Sun, 18 Feb 1996 02:14
Date: Sun, 18 Feb 1996 02:14
39 lines
1728 bytes
1728 bytes
Is it allowed to overload template names based on their parameters
in the same way that functions can be overloaded?
I tried to create two versions of the same class name as such:
template <class C>
class A {
[...]
};
template <class C1, class C2>
class A {
[...]
};
Gcc 2.7.2 gives errors about redefinition even though, as far as I can
tell, these names are distinct.
test.cc:8: declaration of template `template <class C1, class C2> class A'
test.cc:2: conflicts with previous declaration `template <class C> class A'
In the end, I had to create two classes: A1 and A2.
Is this a problem with GCC or does the standard not allow it?
Brian
( bcwhite@bnr.ca )
-------------------------------------------------------------------------------
In theory, theory and practice are the same. In practice, they're not.
[ To submit articles: Try just posting with your newsreader. If that fails,
use mailto:std-c++@ncar.ucar.edu
FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID:
<4g40t8$kpq@bcarh8ab.bnr.ca>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: "brian (b.c.) white" <bcwhite@bnr.ca> Newsgroups: comp.std.c++ Subject: Problem with template overloading Date: 18 Feb 1996 02:14:29 GMT Organization: Bell-Northern Research Ltd. Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4g40t8$kpq@bcarh8ab.bnr.ca> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: bcarsd26.bnr.ca Content-Length: 902 Originator: clamage@taumet