I’m still learning C++ and I need some clarification on something that didn’t make sense to me. I stumbled on this issue as I was initializing some FVector2D using a float but as indicated here the constructor which takes in one float is marked as explicit which is fine.
This is the constructor declaration inside the FVector2D.h
explicit FORCEINLINE FVector2D(float InF);
My question is why is this possible and compiles without any errors ?
FVector2D MyVec = 15.f;
From my understanding this shouldn’t be possible due to the explicit constructor and should give a “no suitable constructor exists error” but it doesn’t or is there something I don’t understand ?