恼火专题

C++备忘录080:C/C++中最让人恼火的特性

隐式类型转换 #include <iostream>#include <variant>#include <string>int main() {auto const v = std::variant<bool, std::string>{"hello"}; std::cout << v.index() << '\n'; // prints 0} 因为"hello"是char cons