None matching arguments.

So, I'm quickly testing some class for a graph data-structure, and I came across a particularly annoying bug.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <iostream>
#include <vector>
#include <string>
using ::std::cout;
using ::std::endl;
using ::std::string;
using ::std::vector;

struct node{
	public:
		string label;
		int value;
		vector<node*> edges;
};


class graph{
	public:

		string set_root_label(string input_string){
		
			root_node.label = input_string;
			return root_node.label;
		}

		int set_root_value(int input_value){
			root_node.value = input_value;
			return root_node.value;
		}

		void set_root_edges(node* input_node){
			root_node.edges.push_back(input_node);
		}

		int get_root_value(){
			return root_node.value;
		}

		string get_root_label(){
			return root_node.label;
		}

		graph(){
			root_node.label = "";
			root_node.value = 0;
			current_node = &root_node;
		}

		int get_currentNode_value(){
			return current_node->value;
		}

		string get_currentNode_label(){
			return current_node->label;
		}

		node* set_currentNode(node* input_node){
			current_node = input_node;
		}

	private:
		node root_node;
		node* current_node;

};

int main(){


	graph G;

	cout << "root value is = " << G.set_root_value(12) << endl;
	cout << "root label is = " << G.set_root_label("A") << endl;

	cout << "current node value is = " << G.get_currentNode_value() << endl;
	cout << "current node label is = " << G.get_currentNode_label() << endl;


	return 0;
}


I have declared a struct....

1
2
3
4
5
6
struct node{
	public:
		string label;
		int value;
		vector<node*> edges;
};


....which the class "graph" member function "set_root_edges" have problems using the push_back() function

1
2
3
void set_root_edges(node* input_node){
	root_node.edges.push_back(input_node);
}


MSVC 2013 says no instance of overloaded function matches argument list. I have no idea what I'm doing wrong.

changing the vector type and argument type to "int" doesn't produce errors.
or even "int*". Same goes for "char" , "string"


perhaps intellisense is just acting up?

::Problem solved, it was the damn stupid intellisense.
Last edited on
Topic archived. No new replies allowed.