Forgive me if this seems a bit naive, but I'm rather new to C++ and after years in C and in Java, I guess my head's a little confused.
I'm trying to make an array of an unknown size full of nodes that I've created.
node *aNode = new node(14,32);
std::list<node> dataSet;
std::list<node>::iterator it;
it = dataSet.begin();
dataSet.insert(it, aNode)
However, when I compile this (proof of concept test), it refuses, throwing all sorts of errors.
I know it's something simple and I just can't figure it out. Can anyone help? Thanks in advance!
edit: Here's node:
class node{
float startPoint;
float endPoint;
float value;
public:
node(float, float);
void setValues(float, float);
};
node::node(float start, float end){
startPoint = start;
endPoint = end;
}
and compiler errors:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2371: 'it' : redefinition; different basic types
error C2440: 'initializing' : cannot convert from 'std::list<_Ty>::_Iterator<_Secure_validation>' to 'int'
error C2146: syntax error : missing ';' before identifier 'dataSet'
error C2143: syntax error : missing ';' before '.'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2371: 'dataSet' : redefinition; different basic types
update: I changed the little bit of code to:
node aNode(14, 32);
std::list<node> dataSet;
dataSet.insert(dataSet.begin(), aNode);
But these 3 errors remain:
error C2143: syntax error : missing ';' before '.'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2371: 'dataSet' : redefinition; different basic types
node*into anodelist?