Thread View: comp.std.c++
1 messages
1 total messages
Started by Jamshid Afshar
Fri, 05 Jan 1996 06:25
Overloaded template functions
Author: Jamshid Afshar
Date: Fri, 05 Jan 1996 06:25
Date: Fri, 05 Jan 1996 06:25
34 lines
1703 bytes
1703 bytes
Hi, folks, long time no see. I'm just wondering if the standard
actually disallows some code of mine containing overloaded function
templates. Fortunately (for my code, bad for me) I think this is just
another VC++ 4 bug wrt templates. Oh well, at least VC++ has improved
to the point that it handles *most* of the stuff I wrote three years
ago under BC++ 3.1.
cl -c bug2.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 10.00.5270 for 80x86
bug2.cpp(16) : error C2668: 'functor' : ambiguous call to overloaded function
(new behavior; please see help)
template<class O, class R>
void functor(O* object, R (O::*method)());
template<class O, class R, class P>
void functor(O* object, R (O::*method)(P));
class M {
public:
int f( char* );
int g( );
};
int main() {
M m;
functor(&m, &M::f);
functor(&m, &M::g); // VC++ 4 incorrectly flags this as ambiguous
return 0;
}
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads