gpt4 book ai didi

dlang 比较类型 : cannot use '==' with types

转载 作者:行者123 更新时间:2023-12-04 09:42:51 24 4
gpt4 key购买 nike

我的代码中有以下行:

static if (typeof(val) == string) {

它没有编译并返回错误 Error: incompatible types for ((string) == (string)): cannot use '==' with types .检查变量类型的正确方法是什么?

最佳答案

正确的做法是使用 is expression周边:is(A == b)像这样:

static if (is(typeof(val) == string)) {

关于dlang 比较类型 : cannot use '==' with types,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34882972/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com