vector push_back

Hey.
Im currently trying to insert some objects into my vector. And to do this i think of using push_back (sound reasonable?)

I try:
1
2
3
4
5
6
		int var;
		for (var = 0; var < nv; ++var) {
			fprintf(stderr, "\nTry inserting\n");
			node->push_back(*(new STSplayNode()));
			fprintf(stderr, "\nElement inserted\n");
		}


where nv = 10 and node is defined as follow in the header:

1
2
3
4
class STSplay {
	private:
             vector<STSplayNode> *node;   
...



There is no errors when compiling, but the output is:

Try inserting

And nothing more. Can any see what im doing wrong
Last edited on
Can't see what you're doing wrong with that limited amount of code.

Things I can't see: Was node ever made to point to an actual vector? Why is it a pointer?

Things I can see. node->push_back(*(new STSplayNode())); is leaking memory on every insertion.
Last edited on
Hey cire. Argh you right. Why do i want node to be pointe. I don't. But I of course want STSplayNode to be it
Topic archived. No new replies allowed.