小编mla*_*lai的帖子

C2676:二进制“<”:“const _Ty”未定义此运算符或转换为预定义运算符可接受的类型

对于下面的代码,我不断收到此错误。

在阅读,我相信我的错误是it++在我的for循环,我试图与更换next(it, 1),但它并没有解决我的问题。

我的问题是,迭代器是给我问题的那个吗?

#include <iostream>
#include <vector>
#include <stack>
#include <set>
using namespace std;

struct Node
{
    char vertex;
    set<char> adjacent;
};


class Graph
{
public:
    Graph() {};
    ~Graph() {};

    void addEdge(char a, char b)
    {
        Node newV;
        set<char> temp;
        set<Node>::iterator n;

        if (inGraph(a) && !inGraph(b)) {
            for (it = nodes.begin(); it != nodes.end(); it++)
            {
                if (it->vertex == a)
                {
                    temp = it->adjacent;
                    temp.insert(b);
                    newV.vertex = b;
                    nodes.insert(newV);
                    n = nodes.find(newV);
                    temp …
Run Code Online (Sandbox Code Playgroud)

c++ iterator graph c++-standard-library stdset

1
推荐指数
1
解决办法
4120
查看次数

标签 统计

c++ ×1

c++-standard-library ×1

graph ×1

iterator ×1

stdset ×1