Type does not provide a call statement

I have this function order, which returnsvector<Node*>

vector<Node*> order(vector<string> nodes, vector<pair<string, string>> dependencies) {
             Graph graph = buildGraph(nodes, dependencies);
             vector<Node*> order = buildOrder(graph.getNodes());
             return order;
}

and I call it like this:

vector<Node*> order2 = order(nodes, deps);

However, the compiler gives this error:

error: type 'std::__1::vector<Node *, std::__1::allocator<Node *> >' does not provide a call operator
        vector<Node*> order2 = order(nodes, deps);
                               ^~~~~
1 error generated.

What is going wrong? 'std::__1::vector<Node *, std::__1::allocator<Node *> >'it seems that there is vector<Node*, <Node*>>or something is happening, but I can not understand this.

+4
source share
1 answer

It’s a little difficult to say a more complete code without your message, but consider the following:

int order(int j, int k)
{   
    return 3;
}   

int main(int argc, char *argv[])
{   
    char order;

    // order(2, 3);                                                
}

This code builds fine. However, uncommenting

    // order(2, 3);                     

makes it crash, as inside main, orderis a symbol, not a function. From the error message, it looks like you might have a similar problem.

+3
source

Source: https://habr.com/ru/post/1649609/


All Articles