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



 DEVELOP > c-Plus-Plus > Trouble with a pointer to a static member of a template class

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
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
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER