Mail Archives: djgpp/2001/12/03/09:20:20
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f
|
From: | "Randy Maddox" <rmaddox AT isicns DOT com>
|
To: | <dj AT delorie DOT com>, <djgpp AT delorie DOT com>
|
Subject: | FW: Problem with template member of template class
|
Date: | Mon, 3 Dec 2001 09:15:07 -0500
|
Message-ID: | <001201c17c04$e94ee620$3502a8c0@nancy>
|
MIME-Version: | 1.0
|
X-Priority: | 3 (Normal)
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
|
Importance: | Normal
|
X-MS-TNEF-Correlator: | 000000009C48F545F726D442AB16EBB632D02A0DE4212000
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6700
|
Reply-To: | djgpp AT delorie DOT com
|
This is a multi-part message in MIME format.
------=_NextPart_000_0013_01C17BDB.0078DE20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello,
Maybe I'm jumping the gun here by following up so soon, but you guys got
back to me so quickly on a couple of other issues that I thought this one
might have gotten lost, either that or maybe I really stumped you with this
one? Or maybe the question was just to stupid for a response? :-) I hope
not!
> -----Original Message-----
> From: Randy Maddox [mailto:rmaddox AT isicns DOT com]
> Sent: Wednesday, November 28, 2001 9:17 AM
> To: djgpp AT delorie DOT com
> Cc: Randy Maddox
> Subject: Problem with template member of template class
>
> Hello,
>
> I am using the WinDoze 2K version of DJGPP as found in the zip archive
> djdev204_alpha_win2k.zip and have encountered an issue compiling a
> template member of a template class. This works fine only so long as the
> template member is both declared and defined in the class declarations.
> However, as soon as I try to define the template member outside of the
> class declarations I get a compile error. For example:
>
> - This compiles fine and works as expected:
>
> // test driver for template class template member
>
> #include <iostream>
>
> template <typename T1> class Test
> {
> public:
>
> Test(const T1 & privateValue)
> : privateValue_(privateValue)
> { }
>
> template <typename T2>
> void Write(const T2 & value)
> {
> std::cout << "Write() value is: " << value << std::endl;
> std::cout << "privateValue is: " << privateValue_ << std::endl
> << std::endl;
> }
>
> private:
>
> const T1 privateValue_;
> };
>
> int main()
> {
> std::cout << "Start of test driver" << std::endl << std::endl;
>
> Test<double> test(3.3);
>
> test.Write("string value");
>
> test.Write(4);
>
> std::cout << std::endl << "End of test driver" << std::endl;
> }
>
> // end of this file
>
>
> However, if I try to move the definition of Write() outside of the class
> declarations as shown here:
>
> // test driver for template class template member
>
> #include <iostream>
>
> template <typename T1> class Test
> {
> public:
>
> Test(const T1 & privateValue)
> : privateValue_(privateValue)
> { }
>
> template <typename T2>
> void Write(const T2 & value);
>
> private:
>
> const T1 privateValue_;
> };
>
>
> template <typename T1>
> template <typename T2>
> void Test<T1>::Write<T2>(const T2 & value)
> {
> std::cout << "Write() value is: " << value << std::endl;
> std::cout << "privateValue is: " << privateValue_ << std::endl
> << std::endl;
> }
>
>
> int main()
> {
> std::cout << "Start of test driver" << std::endl << std::endl;
>
> Test<double> test(3.3);
>
> test.Write("string value");
>
> test.Write(4);
>
> std::cout << std::endl << "End of test driver" << std::endl;
> }
>
> // end of this file
>
>
> Then I get the following compile error:
>
> >gxx test2.cpp
> test2.cpp:25: partial specialization `Write<T2>' of function template
>
> Since, as far as I can tell from the Standard, this looks like the correct
> syntax why do I get this error? Is this a bug? An unsupported feature?
> Or do I just not actually understand the syntax?
>
> Using gxx -v reports the following:
>
> >gxx -v
> Reading specs from C:/djgpp/bin/../lib/gcc-lib/djgpp/3.02/specs
> Configured with: ../configure i586-pc-msdosdjgpp --prefix=/dev/env/DJDIR
> --disable-nls
> Thread model: single
> gcc version 3.0.2
> C:/djgpp/bin/../lib/gcc-lib/djgpp/3.02/collect2.exe c:/djgpp/lib/crt0.o
> -LC:/djgpp/bin/../lib/
> gcc-lib/djgpp/3.02 -LC:/djgpp/bin/../lib/gcc-lib -Lc:/djgpp/lib
> -Lc:/djgpp/lib/gcc-lib/djgpp/3.
> 02 -Lc:/djgpp/bin -Lc:/djgpp/lib
> -LC:/djgpp/bin/../lib/gcc-lib/djgpp/3.02/../../.. -Lc:/djgpp/l
> ib/gcc-lib/djgpp/3.02/../../.. -lstdcxx -lm -lgcc -lc -lgcc -Tdjgpp-x.djl
>
> Thanks.
>
> Randy Maddox
> C++ Author, Architect, Developer
> 703-883-8088 ext. 119 (8 am to 4:30 pm Eastern USA time)
> rmaddox AT isicns DOT com
>
------=_NextPart_000_0013_01C17BDB.0078DE20
Content-Type: application/ms-tnef;
name="winmail.dat"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="winmail.dat"
eJ8+IgcOAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5NaWNy
b3NvZnQgTWFpbC5Ob3RlADEIAQ2ABAACAAAAAgACAAEIAAUABAAAAAAAAAAAAAEJAAQAAgAAAAAA
AAABBoADAA4AAADRBwwAAwAJAAoAAAABAPsAAQOQBgCcDAAAJQAAAAsAAgABAAAACwAjAAAAAAAD
ACYAAAAAAAsAKQAAAAAAAwAuAAAAAAADADYAAAAAAB4ATQABAAAAAQAAAAAAAAAeAHAAAQAAAC8A
AABQcm9ibGVtIHdpdGggdGVtcGxhdGUgbWVtYmVyIG9mIHRlbXBsYXRlIGNsYXNzAAACAXEAAQAA
ABsAAAABwXgXTR+kNgpi+hVGQ5lBokuS3HCYAPsZUSAACwAXDAAAAAACAR0MAQAAABgAAABTTVRQ
OlJNQURET1hASVNJQ05TLkNPTQALAAEOAQAAAEAABg4ALMgxBHzBAQIBCg4BAAAAGAAAAAAAAACc
SPVF9ybUQqsW67Yy0CoNwoAAAAsAHw4BAAAAAgEJEAEAAABlCAAAYQgAAJESAABMWkZ18SDxFQMA
CgByY3BnMTI1FjIA+Atgbg4QMDMzTwH3AqQD4wIAY2gKwHPwZXQwIAcTAoMAUBBmGHBycQ5QENhU
YWj/A3ECgxLhBGQSkxIREOcIVZsHsgKAfQqACMggOwlvLQ4wNQKACoF2CJB3a2kLgGQ0DGBjAFAL
A2NDEgILxCBI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