from void (void*) to void (_cdecl*) (void*)
Author |
Message |
Mohamed BEN SLIMAN #1 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Hi Everybody, Here's my problem: I declared a pointer to a function that has one argument. ///////////////// typedef void (*DELETE_FCT)(void* m_ptrContenu); //////////////// And I used a class CJEListe //////////////////////// class CJELListe { public: // Constructeurs / destructeur CJELListe() ; CJELListe(const CJELListe& LSource) ; virtual ~CJELListe() ; // fonction de modification du contenu int AjouterElement(void* pElement, DELETE_FCT fnDeleteElement) ; int InsererElement(long lPosition, void *pElement, DELETE_FCT fnDeleteElement) ; .... Quote: };
//////////////////////// then I declared a template class that inherites from CJELListe /////////////////////// template <class _T> class CJELListeTypee : public CJELListe { private: void DeleteType( void *pVar) public: CJELListeTypee(); CJELListeTypee(const CJELListeTypee<_T> & listeTypee); virtual ~CJELListeTypee(); int AjouterElement_T( const _T & templateElement) { return CJELListe::AjouterElement( new _T(templateElement), DeleteType); } int InsererElement_T(long lPosition, const _T & tempElment) { return CJELListe::InsererElement( lPosition, new (tempElment), DeleteType ); } .... Quote: };
////////////////// In my main() ///// void main() { CJELListeTypee<int> listInt; int ia = 1; listInt.AjouterElement_T ( ia); Quote: }
//////////////// when compiling, I got this message : C:\Temp\testTypee\testTypee.cpp(70) : error C2664: 'AjouterElement' : cannot convert parameter 2 from 'void (void *)' to 'void (__cdecl *)(void *)' None of the functions with this name in scope match the target type C:\Temp\testTypee\testTypee.cpp(135) : while compiling class-template member function 'int __thiscall CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> &)' Error executing cl.exe. How Have i to proceed to avoid this problem ? I don't have to modify CJELListe because it isn't mine. Thanks in advance, best regards, Mohamed BEN SLIMANE
|
Fri, 10 Oct 2003 16:57:30 GMT |
|
 |
Igor Tandetni #2 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Your typedef is for a nonmember function. You try to pass a member function. void (*T)(void*) and void (CJELListeTypee::*T)(void*) are two different incompatible types, if only because member function accepts one additional implicit parameter ('this' pointer of the instance of the class). -- With best wishes, Igor Tandetnik
Quote: > Hi Everybody, > Here's my problem: > I declared a pointer to a function that has one argument. > ///////////////// > typedef void (*DELETE_FCT)(void* m_ptrContenu); > //////////////// > And I used a class CJEListe > //////////////////////// > class CJELListe > { > public: > // Constructeurs / destructeur > CJELListe() ; > CJELListe(const CJELListe& LSource) ; > virtual ~CJELListe() ; > // fonction de modification du contenu > int AjouterElement(void* pElement, DELETE_FCT > fnDeleteElement) ; > int InsererElement(long lPosition, void *pElement, DELETE_FCT > fnDeleteElement) ; > .... > }; > //////////////////////// > then I declared a template class that inherites from CJELListe > /////////////////////// > template <class _T> > class CJELListeTypee : public CJELListe > { > private: > void DeleteType( void *pVar) > public: > CJELListeTypee(); > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > virtual ~CJELListeTypee(); > int AjouterElement_T( const _T & templateElement) { return > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > int InsererElement_T(long lPosition, const _T & tempElment) { > return CJELListe::InsererElement( lPosition, new (tempElment), > DeleteType ); } > .... > }; > ////////////////// > In my main() > ///// > void main() > { > CJELListeTypee<int> listInt; > int ia = 1; > listInt.AjouterElement_T ( ia); > } > //////////////// > when compiling, I got this message : C:\Temp\testTypee\testTypee.cpp(70) > : error C2664: 'AjouterElement' : cannot convert parameter 2 from 'void > (void *)' to 'void (__cdecl *)(void *)' > None of the functions with this name in scope match the target > type > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > class-template member function 'int __thiscall > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> &)' > Error executing cl.exe. > How Have i to proceed to avoid this problem ? I don't have to modify > CJELListe because it isn't mine. > Thanks in advance, > best regards, > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 04:07:10 GMT |
|
 |
Mohamed BEN SLIMAN #3 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Igor, I moved my DeleteType Function from the class and changed it into template <class _T> void DeleteType( void * p) { .... Quote: }
and i still have the same problem. Could You help me to have this problem solved quickly please ? Best regards, Mohamed BEN SLIMANE Igor Tandetnik a crit : Quote: > Your typedef is for a nonmember function. You try to pass a member function. > void (*T)(void*) > and > void (CJELListeTypee::*T)(void*) > are two different incompatible types, if only because member function > accepts one additional implicit parameter ('this' pointer of the instance of > the class). > -- > With best wishes, > Igor Tandetnik
> > Hi Everybody, > > Here's my problem: > > I declared a pointer to a function that has one argument. > > ///////////////// > > typedef void (*DELETE_FCT)(void* m_ptrContenu); > > //////////////// > > And I used a class CJEListe > > //////////////////////// > > class CJELListe > > { > > public: > > // Constructeurs / destructeur > > CJELListe() ; > > CJELListe(const CJELListe& LSource) ; > > virtual ~CJELListe() ; > > // fonction de modification du contenu > > int AjouterElement(void* pElement, DELETE_FCT > > fnDeleteElement) ; > > int InsererElement(long lPosition, void *pElement, DELETE_FCT > > fnDeleteElement) ; > > .... > > }; > > //////////////////////// > > then I declared a template class that inherites from CJELListe > > /////////////////////// > > template <class _T> > > class CJELListeTypee : public CJELListe > > { > > private: > > void DeleteType( void *pVar) > > public: > > CJELListeTypee(); > > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > > virtual ~CJELListeTypee(); > > int AjouterElement_T( const _T & templateElement) { return > > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > > int InsererElement_T(long lPosition, const _T & tempElment) { > > return CJELListe::InsererElement( lPosition, new (tempElment), > > DeleteType ); } > > .... > > }; > > ////////////////// > > In my main() > > ///// > > void main() > > { > > CJELListeTypee<int> listInt; > > int ia = 1; > > listInt.AjouterElement_T ( ia); > > } > > //////////////// > > when compiling, I got this message : C:\Temp\testTypee\testTypee.cpp(70) > > : error C2664: 'AjouterElement' : cannot convert parameter 2 from 'void > > (void *)' to 'void (__cdecl *)(void *)' > > None of the functions with this name in scope match the target > > type > > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > > class-template member function 'int __thiscall > > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> &)' > > Error executing cl.exe. > > How Have i to proceed to avoid this problem ? I don't have to modify > > CJELListe because it isn't mine. > > Thanks in advance, > > best regards, > > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 20:18:05 GMT |
|
 |
Joe Delekt #4 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Greets, Currently, your code runs into a problem where your base class is dependent upon function pointers to a templated class for which code has not yet been generated. You run into the problem where you need to specify the templated function member pointer in the base class which cannot yet see the template class; the templated class cannot derive from the base because it has not yet been declared. Your code is a good candidate for providing a virtual override, in which you make DeleteType() a virtual member of the CJELListe base class, and then override in your templated derived class. In this case, there is no need to pass the function pointer for the various members, instead, you can take a pointer to the base class and the compiler will ensure the appropriate DeleteType() is called. Regards, Joe
Quote: > Igor, > I moved my DeleteType Function from the class and changed it into > template <class _T> > void DeleteType( void * p) > { > .... > } > and i still have the same problem. > Could You help me to have this problem solved quickly please ? > Best regards, > Mohamed BEN SLIMANE > Igor Tandetnik a crit : > > Your typedef is for a nonmember function. You try to pass a member function. > > void (*T)(void*) > > and > > void (CJELListeTypee::*T)(void*) > > are two different incompatible types, if only because member function > > accepts one additional implicit parameter ('this' pointer of the instance of > > the class). > > -- > > With best wishes, > > Igor Tandetnik
message
> > > Hi Everybody, > > > Here's my problem: > > > I declared a pointer to a function that has one argument. > > > ///////////////// > > > typedef void (*DELETE_FCT)(void* m_ptrContenu); > > > //////////////// > > > And I used a class CJEListe > > > //////////////////////// > > > class CJELListe > > > { > > > public: > > > // Constructeurs / destructeur > > > CJELListe() ; > > > CJELListe(const CJELListe& LSource) ; > > > virtual ~CJELListe() ; > > > // fonction de modification du contenu > > > int AjouterElement(void* pElement, DELETE_FCT > > > fnDeleteElement) ; > > > int InsererElement(long lPosition, void *pElement, DELETE_FCT > > > fnDeleteElement) ; > > > .... > > > }; > > > //////////////////////// > > > then I declared a template class that inherites from CJELListe > > > /////////////////////// > > > template <class _T> > > > class CJELListeTypee : public CJELListe > > > { > > > private: > > > void DeleteType( void *pVar) > > > public: > > > CJELListeTypee(); > > > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > > > virtual ~CJELListeTypee(); > > > int AjouterElement_T( const _T & templateElement) { return > > > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > > > int InsererElement_T(long lPosition, const _T & tempElment) { > > > return CJELListe::InsererElement( lPosition, new (tempElment), > > > DeleteType ); } > > > .... > > > }; > > > ////////////////// > > > In my main() > > > ///// > > > void main() > > > { > > > CJELListeTypee<int> listInt; > > > int ia = 1; > > > listInt.AjouterElement_T ( ia); > > > } > > > //////////////// > > > when compiling, I got this message :
C:\Temp\testTypee\testTypee.cpp(70) Quote: > > > : error C2664: 'AjouterElement' : cannot convert parameter 2 from 'void > > > (void *)' to 'void (__cdecl *)(void *)' > > > None of the functions with this name in scope match the target > > > type > > > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > > > class-template member function 'int __thiscall > > > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> &)' > > > Error executing cl.exe. > > > How Have i to proceed to avoid this problem ? I don't have to modify > > > CJELListe because it isn't mine. > > > Thanks in advance, > > > best regards, > > > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 20:36:51 GMT |
|
 |
Mohamed BEN SLIMAN #5 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Thanks Joe for your answer. It does work :)) Best regards, Mohamed BEN SLIMANE Joe Delekto a crit : Quote: > Greets, > Currently, your code runs into a problem where your base class is > dependent upon function pointers to a templated class for which code has not > yet been generated. You run into the problem where you need to specify the > templated function member pointer in the base class which cannot yet see the > template class; the templated class cannot derive from the base because it > has not yet been declared. Your code is a good candidate for providing a > virtual override, in which you make DeleteType() a virtual member of the > CJELListe base class, and then override in your templated derived class. In > this case, there is no need to pass the function pointer for the various > members, instead, you can take a pointer to the base class and the compiler > will ensure the appropriate DeleteType() is called. > Regards, > Joe
> > Igor, > > I moved my DeleteType Function from the class and changed it into > > template <class _T> > > void DeleteType( void * p) > > { > > .... > > } > > and i still have the same problem. > > Could You help me to have this problem solved quickly please ? > > Best regards, > > Mohamed BEN SLIMANE > > Igor Tandetnik a crit : > > > Your typedef is for a nonmember function. You try to pass a member > function. > > > void (*T)(void*) > > > and > > > void (CJELListeTypee::*T)(void*) > > > are two different incompatible types, if only because member function > > > accepts one additional implicit parameter ('this' pointer of the > instance of > > > the class). > > > -- > > > With best wishes, > > > Igor Tandetnik
> message
> > > > Hi Everybody, > > > > Here's my problem: > > > > I declared a pointer to a function that has one argument. > > > > ///////////////// > > > > typedef void (*DELETE_FCT)(void* m_ptrContenu); > > > > //////////////// > > > > And I used a class CJEListe > > > > //////////////////////// > > > > class CJELListe > > > > { > > > > public: > > > > // Constructeurs / destructeur > > > > CJELListe() ; > > > > CJELListe(const CJELListe& LSource) ; > > > > virtual ~CJELListe() ; > > > > // fonction de modification du contenu > > > > int AjouterElement(void* pElement, DELETE_FCT > > > > fnDeleteElement) ; > > > > int InsererElement(long lPosition, void *pElement, > DELETE_FCT > > > > fnDeleteElement) ; > > > > .... > > > > }; > > > > //////////////////////// > > > > then I declared a template class that inherites from CJELListe > > > > /////////////////////// > > > > template <class _T> > > > > class CJELListeTypee : public CJELListe > > > > { > > > > private: > > > > void DeleteType( void *pVar) > > > > public: > > > > CJELListeTypee(); > > > > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > > > > virtual ~CJELListeTypee(); > > > > int AjouterElement_T( const _T & templateElement) { return > > > > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > > > > int InsererElement_T(long lPosition, const _T & tempElment) > { > > > > return CJELListe::InsererElement( lPosition, new (tempElment), > > > > DeleteType ); } > > > > .... > > > > }; > > > > ////////////////// > > > > In my main() > > > > ///// > > > > void main() > > > > { > > > > CJELListeTypee<int> listInt; > > > > int ia = 1; > > > > listInt.AjouterElement_T ( ia); > > > > } > > > > //////////////// > > > > when compiling, I got this message : > C:\Temp\testTypee\testTypee.cpp(70) > > > > : error C2664: 'AjouterElement' : cannot convert parameter 2 from > 'void > > > > (void *)' to 'void (__cdecl *)(void *)' > > > > None of the functions with this name in scope match the target > > > > type > > > > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > > > > class-template member function 'int __thiscall > > > > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> > &)' > > > > Error executing cl.exe. > > > > How Have i to proceed to avoid this problem ? I don't have to modify > > > > CJELListe because it isn't mine. > > > > Thanks in advance, > > > > best regards, > > > > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 22:48:21 GMT |
|
 |
Mohamed BEN SLIMAN #6 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Thanks Joe for your answer. It does work :)) Best regards, Mohamed BEN SLIMANE Joe Delekto a crit : Quote: > Greets, > Currently, your code runs into a problem where your base class is > dependent upon function pointers to a templated class for which code has not > yet been generated. You run into the problem where you need to specify the > templated function member pointer in the base class which cannot yet see the > template class; the templated class cannot derive from the base because it > has not yet been declared. Your code is a good candidate for providing a > virtual override, in which you make DeleteType() a virtual member of the > CJELListe base class, and then override in your templated derived class. In > this case, there is no need to pass the function pointer for the various > members, instead, you can take a pointer to the base class and the compiler > will ensure the appropriate DeleteType() is called. > Regards, > Joe
> > Igor, > > I moved my DeleteType Function from the class and changed it into > > template <class _T> > > void DeleteType( void * p) > > { > > .... > > } > > and i still have the same problem. > > Could You help me to have this problem solved quickly please ? > > Best regards, > > Mohamed BEN SLIMANE > > Igor Tandetnik a crit : > > > Your typedef is for a nonmember function. You try to pass a member > function. > > > void (*T)(void*) > > > and > > > void (CJELListeTypee::*T)(void*) > > > are two different incompatible types, if only because member function > > > accepts one additional implicit parameter ('this' pointer of the > instance of > > > the class). > > > -- > > > With best wishes, > > > Igor Tandetnik
> message
> > > > Hi Everybody, > > > > Here's my problem: > > > > I declared a pointer to a function that has one argument. > > > > ///////////////// > > > > typedef void (*DELETE_FCT)(void* m_ptrContenu); > > > > //////////////// > > > > And I used a class CJEListe > > > > //////////////////////// > > > > class CJELListe > > > > { > > > > public: > > > > // Constructeurs / destructeur > > > > CJELListe() ; > > > > CJELListe(const CJELListe& LSource) ; > > > > virtual ~CJELListe() ; > > > > // fonction de modification du contenu > > > > int AjouterElement(void* pElement, DELETE_FCT > > > > fnDeleteElement) ; > > > > int InsererElement(long lPosition, void *pElement, > DELETE_FCT > > > > fnDeleteElement) ; > > > > .... > > > > }; > > > > //////////////////////// > > > > then I declared a template class that inherites from CJELListe > > > > /////////////////////// > > > > template <class _T> > > > > class CJELListeTypee : public CJELListe > > > > { > > > > private: > > > > void DeleteType( void *pVar) > > > > public: > > > > CJELListeTypee(); > > > > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > > > > virtual ~CJELListeTypee(); > > > > int AjouterElement_T( const _T & templateElement) { return > > > > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > > > > int InsererElement_T(long lPosition, const _T & tempElment) > { > > > > return CJELListe::InsererElement( lPosition, new (tempElment), > > > > DeleteType ); } > > > > .... > > > > }; > > > > ////////////////// > > > > In my main() > > > > ///// > > > > void main() > > > > { > > > > CJELListeTypee<int> listInt; > > > > int ia = 1; > > > > listInt.AjouterElement_T ( ia); > > > > } > > > > //////////////// > > > > when compiling, I got this message : > C:\Temp\testTypee\testTypee.cpp(70) > > > > : error C2664: 'AjouterElement' : cannot convert parameter 2 from > 'void > > > > (void *)' to 'void (__cdecl *)(void *)' > > > > None of the functions with this name in scope match the target > > > > type > > > > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > > > > class-template member function 'int __thiscall > > > > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> > &)' > > > > Error executing cl.exe. > > > > How Have i to proceed to avoid this problem ? I don't have to modify > > > > CJELListe because it isn't mine. > > > > Thanks in advance, > > > > best regards, > > > > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 22:51:49 GMT |
|
 |
Mohamed BEN SLIMAN #7 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Thanks Joe for your answer. It does work :)) Best regards, Mohamed BEN SLIMANE Joe Delekto a crit : Quote: > Greets, > Currently, your code runs into a problem where your base class is > dependent upon function pointers to a templated class for which code has not > yet been generated. You run into the problem where you need to specify the > templated function member pointer in the base class which cannot yet see the > template class; the templated class cannot derive from the base because it > has not yet been declared. Your code is a good candidate for providing a > virtual override, in which you make DeleteType() a virtual member of the > CJELListe base class, and then override in your templated derived class. In > this case, there is no need to pass the function pointer for the various > members, instead, you can take a pointer to the base class and the compiler > will ensure the appropriate DeleteType() is called. > Regards, > Joe
> > Igor, > > I moved my DeleteType Function from the class and changed it into > > template <class _T> > > void DeleteType( void * p) > > { > > .... > > } > > and i still have the same problem. > > Could You help me to have this problem solved quickly please ? > > Best regards, > > Mohamed BEN SLIMANE > > Igor Tandetnik a crit : > > > Your typedef is for a nonmember function. You try to pass a member > function. > > > void (*T)(void*) > > > and > > > void (CJELListeTypee::*T)(void*) > > > are two different incompatible types, if only because member function > > > accepts one additional implicit parameter ('this' pointer of the > instance of > > > the class). > > > -- > > > With best wishes, > > > Igor Tandetnik
> message
> > > > Hi Everybody, > > > > Here's my problem: > > > > I declared a pointer to a function that has one argument. > > > > ///////////////// > > > > typedef void (*DELETE_FCT)(void* m_ptrContenu); > > > > //////////////// > > > > And I used a class CJEListe > > > > //////////////////////// > > > > class CJELListe > > > > { > > > > public: > > > > // Constructeurs / destructeur > > > > CJELListe() ; > > > > CJELListe(const CJELListe& LSource) ; > > > > virtual ~CJELListe() ; > > > > // fonction de modification du contenu > > > > int AjouterElement(void* pElement, DELETE_FCT > > > > fnDeleteElement) ; > > > > int InsererElement(long lPosition, void *pElement, > DELETE_FCT > > > > fnDeleteElement) ; > > > > .... > > > > }; > > > > //////////////////////// > > > > then I declared a template class that inherites from CJELListe > > > > /////////////////////// > > > > template <class _T> > > > > class CJELListeTypee : public CJELListe > > > > { > > > > private: > > > > void DeleteType( void *pVar) > > > > public: > > > > CJELListeTypee(); > > > > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > > > > virtual ~CJELListeTypee(); > > > > int AjouterElement_T( const _T & templateElement) { return > > > > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > > > > int InsererElement_T(long lPosition, const _T & tempElment) > { > > > > return CJELListe::InsererElement( lPosition, new (tempElment), > > > > DeleteType ); } > > > > .... > > > > }; > > > > ////////////////// > > > > In my main() > > > > ///// > > > > void main() > > > > { > > > > CJELListeTypee<int> listInt; > > > > int ia = 1; > > > > listInt.AjouterElement_T ( ia); > > > > } > > > > //////////////// > > > > when compiling, I got this message : > C:\Temp\testTypee\testTypee.cpp(70) > > > > : error C2664: 'AjouterElement' : cannot convert parameter 2 from > 'void > > > > (void *)' to 'void (__cdecl *)(void *)' > > > > None of the functions with this name in scope match the target > > > > type > > > > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > > > > class-template member function 'int __thiscall > > > > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> > &)' > > > > Error executing cl.exe. > > > > How Have i to proceed to avoid this problem ? I don't have to modify > > > > CJELListe because it isn't mine. > > > > Thanks in advance, > > > > best regards, > > > > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 22:50:15 GMT |
|
 |
Mohamed BEN SLIMAN #8 / 8
|
 from void (void*) to void (_cdecl*) (void*)
Thanks Joe for your answer. It does work :)) Best regards, Mohamed BEN SLIMANE Joe Delekto a crit : Quote: > Greets, > Currently, your code runs into a problem where your base class is > dependent upon function pointers to a templated class for which code has not > yet been generated. You run into the problem where you need to specify the > templated function member pointer in the base class which cannot yet see the > template class; the templated class cannot derive from the base because it > has not yet been declared. Your code is a good candidate for providing a > virtual override, in which you make DeleteType() a virtual member of the > CJELListe base class, and then override in your templated derived class. In > this case, there is no need to pass the function pointer for the various > members, instead, you can take a pointer to the base class and the compiler > will ensure the appropriate DeleteType() is called. > Regards, > Joe
> > Igor, > > I moved my DeleteType Function from the class and changed it into > > template <class _T> > > void DeleteType( void * p) > > { > > .... > > } > > and i still have the same problem. > > Could You help me to have this problem solved quickly please ? > > Best regards, > > Mohamed BEN SLIMANE > > Igor Tandetnik a crit : > > > Your typedef is for a nonmember function. You try to pass a member > function. > > > void (*T)(void*) > > > and > > > void (CJELListeTypee::*T)(void*) > > > are two different incompatible types, if only because member function > > > accepts one additional implicit parameter ('this' pointer of the > instance of > > > the class). > > > -- > > > With best wishes, > > > Igor Tandetnik
> message
> > > > Hi Everybody, > > > > Here's my problem: > > > > I declared a pointer to a function that has one argument. > > > > ///////////////// > > > > typedef void (*DELETE_FCT)(void* m_ptrContenu); > > > > //////////////// > > > > And I used a class CJEListe > > > > //////////////////////// > > > > class CJELListe > > > > { > > > > public: > > > > // Constructeurs / destructeur > > > > CJELListe() ; > > > > CJELListe(const CJELListe& LSource) ; > > > > virtual ~CJELListe() ; > > > > // fonction de modification du contenu > > > > int AjouterElement(void* pElement, DELETE_FCT > > > > fnDeleteElement) ; > > > > int InsererElement(long lPosition, void *pElement, > DELETE_FCT > > > > fnDeleteElement) ; > > > > .... > > > > }; > > > > //////////////////////// > > > > then I declared a template class that inherites from CJELListe > > > > /////////////////////// > > > > template <class _T> > > > > class CJELListeTypee : public CJELListe > > > > { > > > > private: > > > > void DeleteType( void *pVar) > > > > public: > > > > CJELListeTypee(); > > > > CJELListeTypee(const CJELListeTypee<_T> & listeTypee); > > > > virtual ~CJELListeTypee(); > > > > int AjouterElement_T( const _T & templateElement) { return > > > > CJELListe::AjouterElement( new _T(templateElement), DeleteType); } > > > > int InsererElement_T(long lPosition, const _T & tempElment) > { > > > > return CJELListe::InsererElement( lPosition, new (tempElment), > > > > DeleteType ); } > > > > .... > > > > }; > > > > ////////////////// > > > > In my main() > > > > ///// > > > > void main() > > > > { > > > > CJELListeTypee<int> listInt; > > > > int ia = 1; > > > > listInt.AjouterElement_T ( ia); > > > > } > > > > //////////////// > > > > when compiling, I got this message : > C:\Temp\testTypee\testTypee.cpp(70) > > > > : error C2664: 'AjouterElement' : cannot convert parameter 2 from > 'void > > > > (void *)' to 'void (__cdecl *)(void *)' > > > > None of the functions with this name in scope match the target > > > > type > > > > C:\Temp\testTypee\testTypee.cpp(135) : while compiling > > > > class-template member function 'int __thiscall > > > > CJELListeTypee<int>::AjouterElement_T(const class CJELElement_T<int> > &)' > > > > Error executing cl.exe. > > > > How Have i to proceed to avoid this problem ? I don't have to modify > > > > CJELListe because it isn't mine. > > > > Thanks in advance, > > > > best regards, > > > > Mohamed BEN SLIMANE
|
Sat, 11 Oct 2003 22:56:16 GMT |
|
|
|