Sign in to follow this  
Trenki

[Solved] C++ template problem

Recommended Posts

I have a problem in my code which involves templates. Visual Studio compiles it just fine but GCC 4 complains in the line where I do func = &A<Derived>::func_template<x>; Following is a small piece of code that produces the problem. What am I doing wrong? I can't seem to find a solition!
template <typename Derived>
struct A {
	void (A::*func)();
	
	template <int x>
	void test()
	{
		func = &A<Derived>::
			func_template<x>;
	}
	
	template <int x>
	void func_template()
	{}
};


[Edited by - Trenki on June 9, 2007 7:13:44 AM]

Share this post


Link to post
Share on other sites
Solved it myself:

Changed the line

func = &A<Derived>::func_template<x>;

to

func = &A<Derived>::template func_template<x>;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this