Forgive me if this seems a bit naive, but I'm pretty new to C ++ and after several years of working in C and Java, I think my head got a little confused.
I am trying to create an array of unknown size, full of nodes that I 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 conceptual test), it refuses, throwing all kinds of errors.
I know this is something simple, and I just can't figure it out. Can anyone help? Thanks in advance!
edit: Here 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. Note: C ++ does not support default-int
error C2371: 'it': redefinition; various basic types
error C2440: 'initializing': cannot convert from 'std :: list <_Ty> :: _ Iterator <_Secure_validation>' to 'int'
error C2146: syntax error: missing ';' before the identifier 'dataSet'
error C2143: syntax error: missing ';' before '.'
error C4430: missing type specifier - int. Note: C ++ does not support default-int
error C2371: 'dataSet': override; various basic types
update: I changed the code a bit:
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