c++ - Explicit instantiation and overloading
-
Christof Meerwald
(18/18)
Jan 14 2003
template
- news.digitalmars.com (17/35) Jan 29 2003 Another compiler has generated this error to me and this is my work-arou...
- David Thomas (5/48) Jan 29 2003 I apologize for the name being "news.digitalmars.com". I didn't realize
- David Thomas (7/50) Jan 29 2003 Btw, one does not have to provide a definition to a member function if o...
template<class T> struct A { template<class U> void f(const U*) { } void f() { } }; template void A<char>::f(); // Error: no match for function 'f()' Found in Boost's regex library - unfortunately, I don't know of a clean workaround... bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Jan 14 2003
Another compiler has generated this error to me and this is my work-around (maybe this will help you): template<class T> struct A { void f(); }; template<class T> inline void A::f() {} template<> void A<char>::f(); Apparently, the definition of a member function needs to be external to the template class in order to do an explicit declaration of that member function. "Christof Meerwald" <cmeerw web.de> wrote in message news:b0218d$1qf3$1 digitaldaemon.com...template<class T> struct A { template<class U> void f(const U*) { } void f() { } }; template void A<char>::f(); // Error: no match for function 'f()' Found in Boost's regex library - unfortunately, I don't know of a clean workaround... bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Jan 29 2003
I apologize for the name being "news.digitalmars.com". I didn't realize Outlook Express defaulted it. "news.digitalmars.com" <dthomas cogitoinc.com> wrote in message news:b18udi$1him$1 digitaldaemon.com...Another compiler has generated this error to me and this is my work-around (maybe this will help you): template<class T> struct A { void f(); }; template<class T> inline void A::f() {} template<> void A<char>::f(); Apparently, the definition of a member function needs to be external tothetemplate class in order to do an explicit declaration of that member function. "Christof Meerwald" <cmeerw web.de> wrote in message news:b0218d$1qf3$1 digitaldaemon.com...template<class T> struct A { template<class U> void f(const U*) { } void f() { } }; template void A<char>::f(); // Error: no match for function 'f()' Found in Boost's regex library - unfortunately, I don't know of a clean workaround... bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Jan 29 2003
Btw, one does not have to provide a definition to a member function if one wants to force the programmer to provide an explicit instantiation. That way the linker will let the programmer know that there is no definition available. I've had occasional need of this. "news.digitalmars.com" <dthomas cogitoinc.com> wrote in message news:b18udi$1him$1 digitaldaemon.com...Another compiler has generated this error to me and this is my work-around (maybe this will help you): template<class T> struct A { void f(); }; template<class T> inline void A::f() {} template<> void A<char>::f(); Apparently, the definition of a member function needs to be external tothetemplate class in order to do an explicit declaration of that member function. "Christof Meerwald" <cmeerw web.de> wrote in message news:b0218d$1qf3$1 digitaldaemon.com...template<class T> struct A { template<class U> void f(const U*) { } void f() { } }; template void A<char>::f(); // Error: no match for function 'f()' Found in Boost's regex library - unfortunately, I don't know of a clean workaround... bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Jan 29 2003