Compiler will first match fun name and argument, then look for
template deducted function, then use implicit conversion to try match.
So implicit conversion happens the last in fact .
When and How implicit conversion happen:
assignment
other operator
fun call and return
Implicit conversion sometimes will lead to potential ambiguity problem.
in order to avoid this implicit conversion, you can add explicit in front of
constructor function. With explicit keyword, you can use Foo(19) or (Foo)19
to explicitly build a Foo obj.
convert class to basic type, you need operator basicTypeName, no
argument, no return value. member function. double d = double(class)
These cast can be called by compiler implicit, (means that you don’t
know at all). Sometimes it’s quite dangerous. single argument ctor
will happen implicit conversion, just bad smell code in previous
example, A good solution is use explicit keyword to qualify the single
argument ctor. operator build-in-type is not good either, so string
has function c_str() instead operator char*() const. So just useexplicit when you define single argument ctor and operatorbuild-in-type.