开发者社区> 问答> 正文

遇到‘__gnu_cxx::__enable_if<true怎么解决?c报错

遇到‘__gnu_cxx::__enable_if<true怎么解决?c报错

在编写样例代码时出现这种问题。这种情况应该如何解决和避免那?

[Error] invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’

原因是什么,为什么会发生异常,以及下面到底发生了什么。如果有人能帮忙?提前谢谢

展开
收起
爱吃鱼的程序员 2020-05-27 17:41:45 1764 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    楼主,[Error] invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’ abs(a - b) %2 不能这么写需要先用一个变量来接收 abs(a-b)

    2020-05-27 17:51:01
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载