错误:ISO c++禁止指针和整数[-fpermissive]的比较
Error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
template <class ST>
bool OrderedSet<ST>::IsIn (const ST & value) const
{
for (LNode * np = first; np != NULL; np = np -> next)
if (np -> next == value)
return true;
return false;
}
我知道np->next是指针,而value不是。如果指定的数据值在集合中,我想返回true,如果该值不在集合中,我想返回false。
这一行
if (np -> next == value)
应该if (np->data == value)
除了我们不知道你的data
成员变量的名字
相关文章:
- 比较并显示使用最小值(a,b)和最大值(a、b)升序排列的4个数字
- 为什么比较运算符如此快速
- 我可以使用 g++ 进行三种比较 (<=>) 吗?
- 比较字符数组
- 将模板化的类型与C++中的某些类/类型进行比较
- C++自定义比较函数
- 如何比较自定义类的std::变体
- 多个If语句与使用逻辑运算符计算条件的单个语句的比较
- std::设置自定义比较器
- 布尔比较运算符是如何在C++中工作的
- C++将目录中的所有文件与::filesystem进行比较
- shell排序中的交换和比较
- 如何在C++中比较两个char数组
- catch框架有没有办法比较流或文件
- 从文件中读取多个字节,并将它们存储在C++中进行比较
- 智能指针作为无序映射键,并通过引用进行比较
- ISO C++禁止指针和整数 [-fpermissive] [c++] 之间的比较
- 错误:ISO c++禁止指针和整数[-fpermissive]的比较
- ISO C++禁止在C++代码中比较指针和整数[-fpermissive]
- ISO c++禁止在devc++中比较指针和整数[-fpermissive]错误