class Node:protected Model
{
public:
int sizeofneighbour;
VecDbl_t distributions_;
VecDbl_t newDistributions_;
std::shared_ptr<Node> neighbours_[9];
VecInt_t* position;
staticconstdouble PI;
public:
Node(VecInt_t *pos);
~Node();
};
I have a shared pointer neighbours_ with size of 9. I want to define this share pointer with a size which is calculated during run time. I know it should be something like
1 2 3
std::shared_ptr<Node> neighbours_ = std::shared_ptr<Node>(new Node(position));
for (auto i = 0; i < size; i++) {
Node(position).push_back(neighbours_);
}
but I don't know why I can't do the push back. Thanks for your helps in advance.