C ++ vector pointer

How to make a vector that will contain pointers? I tried this, but could not.

vector<*struct_gene> vector_child_genes;

full code if anyone is interested http://codepad.org/50qrNZvd

+3
source share
3 answers
vector<struct_gene *> vector_child_genes;
+11
source

Try something like this:

vector<struct_gene*> vector_child_genes;

You specify the type in the angle brackets of the vector, and pointer types are indicated by the postfix asterisk, not the asterisk.

+3
source

. . * ( , ), .

+1

Source: https://habr.com/ru/post/1754623/


All Articles