RE: [Dev-C++] Template member function (C++ obviously)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: P.D. v. Z. <pa...@my...> - 2003-07-27 17:46:47
|
Hello again,
So THAT's what I was doing wrong! *slaps forehead*
I don't have much experience with template member functions yet, it's
the first time I've used it in a real project. I called the function as
follows (from within a member function of the Config class):
ConfigParser cp;
cp.Parse("somefile.conf", this, &Config::ConfigData);
Which apparently should have been:
ConfigParser cp;
cp.Parse<Config>("somefile.conf", this, &Config::ConfigData);
From the examples and help I found online I got the impression that this
template parameter was implicit... apparently not :) First I thought it
was something I did wrong with the body of the function (not specifying
things that I should, for instance), because almost everywhere the
samples only present inlined code.
But anyway, thanks a lot! Now I can continue with my (much too
time-consuming) little project :)
Greetings,
Paul
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Hossein
Haeri
Sent: Sunday, July 27, 2003 5:34 PM
To: dev...@li...
Subject: Re: [Dev-C++] Template member function (C++ obviously)
Dear Paul,
> I hope anyone can help me, cause I'm starting to consider making the
> entire class a template, just to get rid of the linker error. I
> already switched from Visual C++ 6 to GCC because of one of the many
> bugs in
> VC++6, one of which is that it doesn't seem to understand/support
> template member functions.
Oh, yes! Member templatisation is one of the C++ features that the nasty
MSVC++6 doesn't supports. One of bewildering (known) bugs of it! That's
whilst member templatatisation is completely Standard-compliant, and
that's a shame, out of thousands, for MSVC++6!
Hmmm... One point more: I know that you told the error is engendered by
the linker, but consider the following peice of code which I site
directly from TC++PL:Spec (Section C.13.6):
class Memory{
public:
template<class T> T* get_new();
template<class T> void release(T&);
};
template<class Allocator> void f(Allocator& m)
{
int* p1 = m.get_new<int>();
//Syntax Error: int after less than operator
int* p2 = m.template get_new<int>();
//explicit qualification
//...
m.release(p1);
//template argument deduced: no explicit qualification needed
m.release(p2);
}
Are you sure that's not arisen because of forgetting the "template
qualifier?"
Regards,
--Hossein
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
CareerBuilder.com has over 400,000 jobs. Be smarter about your job
search http://corp.mail.com/careers
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01
/01
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|