RE: [Dev-C++] Template member function (C++ obviously)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Hossein H. <ult...@em...> - 2003-07-27 18:49:31
|
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
|