C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compile error with overloaded functions

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Jef Driesen
Guest





PostPosted: Thu Jan 29, 2004 3:24 pm    Post subject: Compile error with overloaded functions Reply with quote



I have 4 overloaded functions 'deallocate':

template <typename T> void deallocate(T* mem);
template <typename T> void deallocate(T** mem);
template <typename T> void deallocate(T*** mem);
template <typename T> void deallocate(T**** mem);

When i try to compile code like:

double ***image= allocate<double>(bands, rows, columns);
deallocate(image);

I get the following errors:

error C2667: 'deallocate' : none of 3 overload have a best conversion
error C2668: 'deallocate' : ambiguous call to overloaded function

When I write deallocate<double>(image) or deallocate<>(image), it compiles
without errors.
Why is this necessary? Or is it this only a problem with MSVC6?





Back to top
Michael Mellor
Guest





PostPosted: Thu Jan 29, 2004 3:29 pm    Post subject: Re: Compile error with overloaded functions Reply with quote



Jef Driesen wrote:

Quote:
I have 4 overloaded functions 'deallocate':

template <typename T> void deallocate(T* mem);
template <typename T> void deallocate(T** mem);
template <typename T> void deallocate(T*** mem);
template <typename T> void deallocate(T**** mem);

When i try to compile code like:

double ***image= allocate<double>(bands, rows, columns);
deallocate(image);

I get the following errors:

error C2667: 'deallocate' : none of 3 overload have a best conversion
error C2668: 'deallocate' : ambiguous call to overloaded function

When I write deallocate<double>(image) or deallocate<>(image), it compiles
without errors.
Why is this necessary? Or is it this only a problem with MSVC6?

It is a problem with MSVC 6.


Michael Mellor

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.