我还应该为复制构造函数使用关键字 explicit 吗?

Should I still use the keyword explicit for copy constructors?

C++ provides the keyword explicit to suppress implicit conversions via conversion constructors when such conversions should not be allowed. A constructor that's declared explicit cannot be used in an implicit conversion. Use the explicit keyword on single-argument constructors that should not be used by the compiler to perform implicit conversions.

这是有道理的,但是我仍然应该为复制构造函数使用关键字 explicit 吗?在哪些其他情况下使用关键字 explicit 会有用,为什么?

显式声明复制构造函数是合法的。声明与否真的取决于你想做什么。例如,如果你想禁止在函数调用时或使用复制初始化语法隐式调用它,你可以声明一个复制构造函数 explicit