Implicit conversions in C++ can be avoided by using braced initialization:
int x = {3.0}; // compiler error
However, in a class, you may want to avoid narrowing conversions as well:
class X {
public:
(int x): x_(x) {} // construct with int
X(const auto x) = delete;
Xint x_;
};
int main() {
(5.1); // this uses a float constructor, which has been deleted. Compiler error
X x}