4 ms·
If you mark the constructor as explicit, the automatic cast you mention does not take place and you'll get a compile time error. The casting style can be enfor
by 29athrowaway 6y ago
If you mark the constructor as explicit, the automatic cast you mention does not take place and you'll get a compile time error.
The casting style can be enforced via linting. There are also C++ cast operators, that in my opinion should be preferred to the C style casts: static_cast, dynamic_cast, reinterpret_cast, const_cast, static_pointer, dynamic_pointer_cast, const_pointer_cast... and you can enforce that those are preferred rather than C style casts.