473,382 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Trouble with a pointer to a static member of a template class

Hello.

Given the following template class:

template <unsigned int dim = 3>
class Morfologia
{
public:
static Pgm dilata(const Pgm&, const ElementoEstruturante<dim>&);
// ...
};

I wish to declare and define a pointer to the static member above. This
is what I have tried:

Pgm (Morfologia<5>::*operador)(const Pgm&, const ElementoEstruturante<5>&);

operador = &Morfologia<5>::dilata;

But the compiler tells me it is unable to do a suitable conversion
("there is no context in which this conversion is possible").

Could anyone point out what is it that I am missing?

Thank you,

--
Ney André de Mello Zunino
Jul 22 '05 #1
1 1039

"Ney André de Mello Zunino" <zu****@inf.ufsc.br> wrote in message
news:31*************@individual.net...
Hello.

Given the following template class:

template <unsigned int dim = 3>
class Morfologia
{
public:
static Pgm dilata(const Pgm&, const ElementoEstruturante<dim>&);
// ...
};

I wish to declare and define a pointer to the static member above. This
is what I have tried:

Pgm (Morfologia<5>::*operador)(const Pgm&, const ElementoEstruturante<5>&);
Pointers to static member functions do not have pointer-to-member type. They are
ordinary function pointers.

This should be:

Pgm (*operador)(const Pgm&, const ElementoEstruturante<5>&);

operador = &Morfologia<5>::dilata;


Jonathan
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff | last post by:
/* -------------------------------------------------------------------------- Hello, I was experimenting with class templates and specializing member functions and came across a simple problem...
2
by: Brandon | last post by:
In a templated class I wrote, there is a public typedef for a function pointer. The class has an instance of the function pointer as a private member. That pointer is declared as static so I need...
1
by: Adam Dziendziel | last post by:
Hi all! I'm writing a luabind/boost::python-like binding utility for a Squirrel language to generating wrapper-functions for C++ classes and have a problem with passing the pointer-to-member...
11
by: Enquiries, Hopkins Research | last post by:
Hi all I have a conundrum that is puzzling me. I have a large codebase in C that I am converting to C++ as fast as possible (i.e. slowly because I keep learning new idioms and stumbling with...
5
by: StephQ | last post by:
This is from a thread that I posted on another forum some days ago. I didn't get any response, so I'm proposing it in this ng in hope of better luck :) The standard explanation is that pointer...
8
by: amirr | last post by:
Guys, As you know static member functions do not have a this pointer. so instead, what shall i do? for example ... consider I want to call Code: ( text ) 1.
2
by: mrstephengross | last post by:
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...
5
by: Tim Frink | last post by:
Hi, I'm experimenting with function pointers and found two questions. Let's assume this code: 1 #include <iostream> 2 class A; 3 4 //////////////////////////////////////////// 5 class B
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.