| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"=?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=" |
| Date: |
05 Dec 2004 06:28:24 PM |
| Object: |
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
.
|
|
| User: "Jonathan Turkanis" |
|
| Title: Re: Trouble with a pointer to a static member of a template class |
05 Dec 2004 05:31:49 PM |
|
|
"Ney André de Mello Zunino" <zunino@inf.ufsc.br> wrote in message
news:31hjj3F3ceecjU1@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
.
|
|
|
|

|
Related Articles |
|
|