M
mrstephengross
Hi folks! I'm trying to create a function pointer to a templatized,
static, overloaded member function. My class (Mgr) has two functions
with the same name: "go". The first takes a T reference (T is a
template argument), and an int. The second takes a T reference and two
ints.
Here's the code:
=================
#include <iostream>
struct Mgr
{
template<class T> static void go(T &, int);
template<class T> static void go(T &, int, int);
};
int main()
{
void (Mgr::*foo) (char &, int) = Mgr::go<char>;
return 0;
}
======== EOF =======
Using gcc 3.4.6, I get the following compile error:
test.cpp: In function `int main()':
test.cpp:12: error: no matches converting function `go' to type `void
(struct Mgr::*)(char&, int)'
test.cpp:5: error: candidates are: template<class T> static void
Mgr::go(T&, int)
test.cpp:7: error: template<class T> static void
Mgr::go(T&, int, int)
Apparently, g++ can't figure out which version of Mgr::go(...) I'm
talking about. Is there any way to disambiguate in this case?
Thanks,
--Steve ([email protected])
static, overloaded member function. My class (Mgr) has two functions
with the same name: "go". The first takes a T reference (T is a
template argument), and an int. The second takes a T reference and two
ints.
Here's the code:
=================
#include <iostream>
struct Mgr
{
template<class T> static void go(T &, int);
template<class T> static void go(T &, int, int);
};
int main()
{
void (Mgr::*foo) (char &, int) = Mgr::go<char>;
return 0;
}
======== EOF =======
Using gcc 3.4.6, I get the following compile error:
test.cpp: In function `int main()':
test.cpp:12: error: no matches converting function `go' to type `void
(struct Mgr::*)(char&, int)'
test.cpp:5: error: candidates are: template<class T> static void
Mgr::go(T&, int)
test.cpp:7: error: template<class T> static void
Mgr::go(T&, int, int)
Apparently, g++ can't figure out which version of Mgr::go(...) I'm
talking about. Is there any way to disambiguate in this case?
Thanks,
--Steve ([email protected])