Why does the compiler choose bool over string for implicit typecast of L“”?

后端 未结 5 2161
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 19:12

Having recently introduced an overload of a method the application started to fail. Finally tracking it down, the new method is being called where I did not expect it to be.

5条回答
  •  盖世英雄少女心
    2020-12-01 19:40

    You could make the new function take some other type than bool--maybe just a proxy for bool--which is not convertible from a literal string. But really I'd just rename the bool-taking function and be done with it.

提交回复
热议问题