S
Size: a a a
S
SS
SS
S
SS
S
AS
d
SS
S
О
struct cluster {
shared_ptr<cluster> left,right;
weak_ptr<cluster> father;
};
void f(cluster& left, cluster& right) {
right.father = left.father = make_shared<cluster>();
right.father.lock()->left = make_shared<cluster>(left);
//right.father.lock()->right = make_shared<cluster>(right);
}
int main() {
cluster left;
cluster right;
f(left,right);
return 0;
}
О
AS
struct cluster {
shared_ptr<cluster> left,right;
weak_ptr<cluster> father;
};
void f(cluster& left, cluster& right) {
right.father = left.father = make_shared<cluster>();
right.father.lock()->left = make_shared<cluster>(left);
//right.father.lock()->right = make_shared<cluster>(right);
}
int main() {
cluster left;
cluster right;
f(left,right);
return 0;
}
О
О
auto father = make_shared<cluster>();
right.father = left.father = father;
father->left = make_shared<cluster>(left);
K
struct cluster {
shared_ptr<cluster> left,right;
weak_ptr<cluster> father;
};
void f(cluster& left, cluster& right) {
right.father = left.father = make_shared<cluster>();
right.father.lock()->left = make_shared<cluster>(left);
//right.father.lock()->right = make_shared<cluster>(right);
}
int main() {
cluster left;
cluster right;
f(left,right);
return 0;
}
AS
О
auto father = make_shared<cluster>();
right.father = left.father = father;
father->left = make_shared<cluster>(left);
K
AS