This is ambiguous because 0 is of type int , not size_t . It can convert either size_t or a pointer, so if you have an overload of both, this is ambiguous. In general, I would recommend that if you have overloaded functions, and one of them can take an integral type, you add an overload for int , perhaps line by line:
inline void DoSomething( int aiValue ) { DoSomething( static_cast<size_t>( aiValue ) ); }
Integral literals are of type int by default (unless they are too large to fit into int ), and by providing an exact match, you avoid any ambiguity.
source share