Quantcast
Channel: C++ conversion operator and overload resolution - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by James Kanze for C++ conversion operator and overload resolution

Because template argument deduction doesn't take user defined implicitconversions into account. The result is that when you wrote: test << source;, the compiler could not find a suitable T for...

View Article



Answer by Grizzly for C++ conversion operator and overload resolution

Implicit deduction of template arguments will not consider user defined implicit conversions. As such calling template <class T> void operator <<(A<T> &, const T *) would deduce T...

View Article

Answer by Mark B for C++ conversion operator and overload resolution

It uses T's implicit conversion to wchar_t. Any type is convertible to void* so the compiler calls that version of the operator<<. The T* operator was never a candidate because there was no way...

View Article

C++ conversion operator and overload resolution

Given this example, which includes a few overloads:#include <iostream>class T{ public: operator const wchar_t *(void) const { std::cout << "Conversion"<< std::endl; return L"Testing";...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images