Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Compile error with overloaded functions

Reply
Thread Tools

Compile error with overloaded functions

 
 
Jef Driesen
Guest
Posts: n/a
 
      01-29-2004
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?





 
Reply With Quote
 
 
 
 
Michael Mellor
Guest
Posts: n/a
 
      01-29-2004
Jef Driesen wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
computation at compile time i.e. compile time functions usingtemplates Carter C++ 2 03-04-2009 06:43 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
Overloaded functions: Compile OK on MSVC++ but not on g++ user@domain.invalid C++ 4 10-21-2005 11:50 AM
overloaded operators and namespaces compile problems George Economos C++ 4 08-23-2005 05:07 PM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57