Clang-Tidy: Single-argument constructors must be marked explicit to avoid unintentional implicit conversions

当c++类构造器允许有一个参数构造时,应该注明 explicit 修饰符,避免类与单参数转换。
比如当赋值3给这个Student实例,之后可能会多次赋值或切换代码,以至于忘记了赋值的数据是int还是struct。
本文来自博客园,作者:ukyo--碳水化合物,转载请注明原文链接:https://www.cnblogs.com/ukzq/p/18529389

浙公网安备 33010602011771号