Hello newsgroup,
I try to take the address of a member template function, but I can't
succeed. My copy of Bjarne Stroupstrup says nothing against this, so I
guess that what I want to achive is not beyond the possibilities of C++,
but beyond the abilities of my compiler (Visual C++ 6.0). Following code
won't compile (error C2039: 'SomeFunc' : Is no element of '`global
namespace''). Any suggestions would be highly appreciated.
class TestClass
{
public:
template<int t_ID>
void SomeFunc ()
{}
};
void (TestClass::*pFuncPtr) () = TestClass<0>::SomeFunc;
Thanks in advance,
Stuart 2 2350
On Feb 13, 10:16 am, Stuart Redmann <DerTop...@web.dewrote:
I try to take the address of a member template function, but I can't
succeed. My copy of Bjarne Stroupstrup says nothing against this, so I
guess that what I want to achive is not beyond the possibilities of C++,
but beyond the abilities of my compiler (Visual C++ 6.0). Following code
won't compile (error C2039: 'SomeFunc' : Is no element of '`global
namespace''). Any suggestions would be highly appreciated.
class TestClass
{
public:
template<int t_ID>
void SomeFunc ()
{}
};
void (TestClass::*pFuncPtr) () = TestClass<0>::SomeFunc;
Two suggestions:
1. Your syntax is wrong. Change the last line to:
void (TestClass::*pFuncPtr) () = &TestClass::SomeFunc<0>;
2. Get a new compiler - Visual C++ 6.0 is horribly out of date.
Best regards,
Tom
Thomas Tutone wrote:
On Feb 13, 10:16 am, Stuart Redmann <DerTop...@web.dewrote:
>>I try to take the address of a member template function, but I can't succeed. My copy of Bjarne Stroupstrup says nothing against this, so I guess that what I want to achive is not beyond the possibilities of C++, but beyond the abilities of my compiler (Visual C++ 6.0). Following code won't compile (error C2039: 'SomeFunc' : Is no element of '`global namespace''). Any suggestions would be highly appreciated.
class TestClass { public: template<int t_ID> void SomeFunc () {}
};
void (TestClass::*pFuncPtr) () = TestClass<0>::SomeFunc;
Two suggestions:
1. Your syntax is wrong. Change the last line to:
void (TestClass::*pFuncPtr) () = &TestClass::SomeFunc<0>;
That is what I was afraid of: With this syntax I get
fatal error C1001: INTERNAL COMPILER- ERROR
2. Get a new compiler - Visual C++ 6.0 is horribly out of date.
I will. Honestly.
Thanks,
Stuart This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Domenico Andreoli |
last post by:
hello,
i have the following problem: taking the pointer of a particular
instantiation of template member function A::f. i have no idea of how
achieve in the intent. :(
any halp or hint would...
|
by: Brian Riis |
last post by:
Given:
template <typename T1, typename T2>
class A
{
public:
template <int I>
void B();
};
|
by: Levent |
last post by:
Hi,
Why doesn't this work? (tried with gcc 3.3.3 and VC++ 7.1):
#include <iostream>
template<class T, unsigned N>
struct Foo {
void func();
};
template<class T, unsigned N>
|
by: Frederiek |
last post by:
Hi,
When modifying a data member in a class declaration, the static keyword
specifies that one copy of the member is shared by all instances of the
class.
Does that mean that the address of...
|
by: James Aguilar |
last post by:
Guys,
When I specialize a template class member function (I.e. a member
function of a template class) based on that class' type, bad things
happen. Here's some code:
---- test_header.h...
|
by: =?iso-8859-1?q?Erik_Wikstr=F6m?= |
last post by:
I'd like to create a partial specialization of a member-method of a
parameterized class which takes a parameterized argument, but I'm not
sure if it's possible or, if possible, how. The following...
|
by: toton |
last post by:
Hi,
I want to specialize template member function of a template class .
It is creating some syntax problem ....
Can anyone say how to do it ?
The class is something like this
template<typename...
|
by: pascal.zschumme |
last post by:
hello folks
My problem is that the following code using something very very
difficult technique :D fails to compile on MSVC8:
<code>
// main.cpp
//
// the error is:
// main.cpp(8) : fatal...
|
by: Barry |
last post by:
The following code compiles with VC8
but fails to compiles with Comeau online,
I locate the standard here:
An explicit specialization of any of the following:
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |