I have a bunch of functions overloaded for all types of [u]int{8|16|32|64}_t :
std::string f( uint8_t) { } std::string f( int8_t) { } std::string f(uint16_t) { } std::string f( int16_t) { } std::string f(uint32_t) { } std::string f( int32_t) { } std::string f(uint64_t) { } std::string f( int64_t) { }
Now I call the function name with an argument of type long unsigned int :
template <typename type_blah> class Something { public:
This causes an error:
error: calling overloaded 'f (long unsigned int &)' is ambiguous
This happens, I suppose, because unsigned int and uint32_t are different types. But I can no longer overload the function anymore for long unsigned int , because this is a redundant definition. I.e:.
std::string f(long unsigned int) { }
., produces:
error: 'std :: string f (uint32_t)' previously defined here
It seems that type mechanisms work against each other: it cannot determine which transformation to use, because each transformation is equally valid, but congestion without conversion cannot be determined, since it already was.
I cannot use the argument for various reasons. Is there a way out of this?
The g ++ MinGW x86 platform runs on Windows 7 x86-64.
c ++
imallett
source share