2 ms·
Note this isn't really specific to Google, or really much of a "convention" (insofar as a convention is something you can reasonably avoid following). This is t
by dataflow 2y ago
Note this isn't really specific to Google, or really much of a "convention" (insofar as a convention is something you can reasonably avoid following). This is the only correct way to write C++, really -- implicit 1-arg constructors are specifically called "converting constructors" [1], precisely because their very purpose is to define implicit conversions. You don't define them unless implicit conversions make sense for your type. The standard library pays attention to this just as much -- that's why size_t isn't implicitly convertible to std::vector.
[1] https://en.cppreference.com/w/cpp/language/converting_constructor https://en.cppreference.com/w/cpp/language/converting_constr...
- wrsh07 2y agoOf course (having learned most of my cpp at Google) I agree with you. However, the language default is incorrect (you have to opt out of implicit conversions rather than opt in) which is why I phrased it like that