Why are you giving your std::string and your node instances the same name as each other?
string stateString; //"stateString" now used up
node stateString; //what?? "stateString" is already used, this doesn't compile
Edit: Ah, you seem to be confused - the name of the node is not remembered by the queue, it is just a way to tell apart that specific struct from another in your programming, and it is not considered at all when you actually run the program. Variable names are meaningless and are only there for us humans.
Perhaps you want a std::map<std::string, node> instead?
1 2 3
std::map<std::string, node> MyMap;
MyMap["Some String or name, for instance"] = MyNode;
That was my attempt to create a new struct with the value that was stored in stateString. Obviously it did not work. That is why I am asking people here how to do it. Do you have a solution or are you just curious?
Your node class has no way to store any kind of string, why would you expect it to?
For reference, it is not that I am curious; I am trying to ask you questions that lead to you understanding your mistake on your own. I cannot tell you what you are misunderstanding because I do not know, and you can't tell us because you don't know either until after you actually understand it.
And I provided a possible solution, but you must have seen my post before I edited it in.
That was my attempt to create a new struct with the value that was stored in stateString.
What do you mean by that? stateString is a string. A node is a structure containing an array of integers and some more integers. How can the structure have the value that was stored in the string, when they are of different types?
Edit: In any case, declaring two objects with the same name does not cause the second one to contain the same value as the first, even if they do have the same type. What you want to do is create a second object with a different name, and then assign to it the value of the first:
You need to modify your definition of your node struct.
This is code from your first post:
1 2 3 4 5 6 7
You can add the ability to contain a std::string like this:
1 2 3 4 5 6 7 8
Then, when you make an instance of your node, you can create it one of these two ways:
1 2 3 4 5 6
node MyFirstNode; //make a node called MyFirstNode
MyFirstNode.nodeState = /*something*/;
MyFirstNode.d = /*something*/;
MyFirstNode.h = /*something*/;
MyFirstNode.c = /*something*/;
MyFirstNode.state = "something"; //it's a string
Then you can add it to your queue as you originally tried.
I'm not sure what your plan is with the int array nodeState; because it is in a struct and you gave it no specific size, it has degraded to only being an integer pointer and not an actual array. You would probably have to use dynamic memory for that, which involves new and delete. I'm guessing you don't actually need this array, though, and that it was just your attempt to put the string into the node.
If you declare its size there, then it is an array.
This struct has a pointer, not an array:
1 2 3 4 5
int MyArray; //NOT an array!
//sizeof(MyStruct) == sizeof(int *)
Whereas this struct does have an array and not a pointer:
1 2 3 4 5
//sizeof(MyStruct) == sizeof(int)*10
If you always specify the number, it will be an array stored within the structure, and there is nothing special to do. If you don't specify a size it degrades into a pointer automatically, and you have to use dynamic memory management.