473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Compile error with overloaded functions

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?

Jul 22 '05 #1
1 1420
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
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Nitin Bhardwaj | last post by:
Thanx in advance for the response... I wanna enquire ( as it is asked many a times in Interviews that i face as an Engg PostGraduate ) about the overloading capability of the C++ Language. ...
7
by: Victor Hannak | last post by:
I have the following 2 files as part of my project: GenFuncs.h ------------ #ifndef GenFuncsH #define GenFuncsH #include <iostream.h> #include <strstream.h> using namespace std;
4
by: user | last post by:
I am trying to port a simple vector/matrix class library to mingw (v3.4.2). I have used this library with no problem on MSVC++ v6 for a number of years. My difficulty is that it does not compile...
44
by: bahadir.balban | last post by:
Hi, What's the best way to implement an overloaded function in C? For instance if you want to have generic print function for various structures, my implementation would be with a case...
3
by: cybertof | last post by:
Hello, Is it possible in C# to have 2 overloaded functions with - same names - same parameters - different return type values If no, is it possible in another language ?
4
by: Vish | last post by:
Hi all, I am having a build error in one of the overloaded functions in my class. The function takes either a string as a parameter or a type referenced in another dll as a parameter. My class...
4
by: chrisstankevitz | last post by:
This code does not compile on gcc 3.4.4. Should it? Thanks for your help, Chris //================ #include <set> int main()
13
by: mike3 | last post by:
Hi. (crossposted because the program is in C++ and some C++-related elements are discussed, hence comp.lang.c++, plus general program design questions are asked, hence comp.programming.) I'm...
7
by: ma740988 | last post by:
Consider the equation (flight dynamics stuff): Yaw (Degrees) = Azimuth Angle(Radians) * 180 (Degrees) / 3.1415926535897932384626433832795 (Radians) There's a valid reason to use single...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.