Please take a look at this code and run it:
I’m getting very strange error:
Error 1 error C2663: ‘Allocator::allocate_help’ : 2 overloads have no legal conversion for ‘this’ pointer
template<class FailureSignal>
class Allocator
{
private:
template<class Exception,class Argument>
void allocate_help(const Argument& arg,Int2Type<true>)
{
}
template<class Exception,class Argument>
std::nullptr_t allocate_help(const Argument& arg,Int2Type<false>)
{
return nullptr;
}
public:
template<class T>
void Allocate(signed long int nObjects,T** ptr = 0)const
{
allocate_help<std::bad_alloc>(1,Int2Type<true>());
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Allocator<int> all;
all.Allocate<int>(1);
return 0;
}
I absolutely do not understand this err msg. Hope someone can help me with this. Thank you.
I noticed
Allocateis declaredconstbutallocate_helpis not – could that be related to the issue?