Compile error with overloaded functions

J

Jef Driesen

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?
 
M

Michael Mellor

Jef said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top