IZ
Про три не понял, это вообще никак ни на что не влияет
Size: a a a
IZ
E
class Node {как лучше реализовать метод GetValue? что он должен возвращать?
public:
??? GetValue() const {
if (holds_alternative<int>(value)) return get<int>(value);
else if ...
else ...
}
private:
variant<int, double, string> value;
}
C
class Node {как лучше реализовать метод GetValue? что он должен возвращать?
public:
??? GetValue() const {
if (holds_alternative<int>(value)) return get<int>(value);
else if ...
else ...
}
private:
variant<int, double, string> value;
}
АК
class Node {как лучше реализовать метод GetValue? что он должен возвращать?
public:
??? GetValue() const {
if (holds_alternative<int>(value)) return get<int>(value);
else if ...
else ...
}
private:
variant<int, double, string> value;
}
value
E
value
АК
АК
E
писать```
void PrintTree() const {
cout << GetValue() << ':' << endl << setw(10);
}
вместо
void PrintTree() const {```
if (holds_alternative<int>(value)) cout << get<int>(value);
else if (holds_alternative<double>(value)) cout << get<double>(value);
else cout << get<string>(value);
}
E
писать```
void PrintTree() const {
cout << GetValue() << ':' << endl << setw(10);
}
вместо
void PrintTree() const {```
if (holds_alternative<int>(value)) cout << get<int>(value);
else if (holds_alternative<double>(value)) cout << get<double>(value);
else cout << get<string>(value);
}
АК
писать```
void PrintTree() const {
cout << GetValue() << ':' << endl << setw(10);
}
вместо
void PrintTree() const {```
if (holds_alternative<int>(value)) cout << get<int>(value);
else if (holds_alternative<double>(value)) cout << get<double>(value);
else cout << get<string>(value);
}
std::visit([](const auto& v) { cout << v; }, GetValue());
E
E
E
IZ
IZ
T
E
IZ
T
IZ