Reputation: 107
How do i make vector which will have pointers in it? Tried this but failed.
vector<*struct_gene> vector_child_genes;
full code if some one is interested http://codepad.org/50qrNZvd
Upvotes: 3
Views: 628
Reputation: 347216
You put the type inside the brackets. There is no special syntax otherwise. If you normally declare a pointer with a * after the type (I hope so) then you still do that same thing.
Upvotes: 1
Reputation: 44066
Try something like this:
vector<struct_gene*> vector_child_genes;
You specify a type in the angle brackets of the vector, and pointer types are specified with a postfix asterisk, not a prefix asterisk.
Upvotes: 3