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-29 20:50:46
|
:'(
It appears I'm still having problems... I thought they were gone. It
compiled fine once using
ConfigParser cp;
cp.Parse<Config>("blah", this, &Config::func);
But now I try to use it in some other class as well (the call to
ConfigParser::Parse), and I get linker errors for both the calls...
[Linker error] undefined reference to `void
ConfigParser::Parse<Language>(std::string const&, Language*, bool
(Language::*)(ConfigLine const&))'
[Linker error] undefined reference to `void
ConfigParser::Parse<Config>(std::string const&, Config*, bool
(Config::*)(ConfigLine const&))'
So once again I'm stumped. I tried your suggestion:
ConfigParser cp;
cp.template Parse<Config>("blah", this, &Config::func);
Which compiles as well, but still gives me linker errors. Maybe I
should've studied templates a bit more before trying to use them :P
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Hossein
Haeri
Sent: Sunday, July 27, 2003 8:49 PM
To: dev...@li...
Subject: RE: [Dev-C++] Template member function (C++ obviously)
Hi Paul,
> So THAT's what I was doing wrong! *slaps forehead*
Ouch! Don't be that furious! It doesn't kill you if it goes wrong!
> I don't have much experience with template member functions yet, it's
> the first time I've used it in a real project. ...
You will obtain much experience just by experiment, Inshaallaah. Keep on
man!
> 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);
Hmmm... It seems that it is not complete yet! Does it work on your
compiler? I will be astonished hearing that MSVC++6 can conclude the
template parameter using the return type. According the citation I made
from TC++PL:Spec, the flawless version should be like this:
cp.template Parse<Config>("somefile.conf", this, &Config::ConfigData);
Furthermore, it seems that something is going wrong here. According to
the Standard, Template parameters could not be deduced using the return
type, but the compilers are supposed to have the ability of deducting
the parameter type using the arguments. (This is explicitly mentioned in
TC++PL as well.) Now, does it have any problem with deducting the
template parameter type using the arguments? Could you please rewrite
the template function's skeleton?
> ... But anyway, thanks a lot! Now I can continue with my (much too
> time-consuming) little project :)
You'r welcome! There is no need to thanks! This is a friendly mailing-
list.
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
|