Sorry for the messy title, I'm not quite sure how I should word it to better get my meaning across.
So, I have
struct Person
{
std::string id_ = NO_ID;
int height_ = NO_HEIGHT;
std::vector<Person*> parents_{nullptr, nullptr};
std::vector<Person*> children_;
};
and I want to be able to populate a map of Person(s) with data.
I made
using Personmap = std::map<std::string, Person >;
for it, but I'm not sure whether I should use *Person
or Person
here.
When I use Person
, I at least know how to work with it, but when I try populating the vectors with data using anything like
persons_[child].parents_[0] = ( persons_[parent_1] );
or similar, I'm getting an error because I'm trying to populate it with Person
instead of Person*
. Apart from the error message, I don't quite understand their difference and I'm not sure what I should utilize to make it work. The struct is not something I can change, but anything else here is free for scrutiny