这是一个创建于 1856 天前的主题,其中的信息可能已经有所发展或是发生改变。
我想要的是类似这样的东西:
struct leaf_type {};
struct value_type {};
struct binary_tree
{
value_type val;
std::variant<binary_tree, leaf_type> left_branch;
std::variant<binary_tree, leaf_type> right_branch;
};
但 std::variant 其实不支持这种写法,
请问各位大佬这方面有什么最佳实践么?
3 条回复 • 2019-09-06 15:35:39 +08:00
|
|
2
geelaw 2019-09-06 15:17:52 +08:00
自己处理复制就行了。
|
|
|
3
wutiantong 2019-09-06 15:35:39 +08:00
@ geelaw 自己处理复制太麻烦了,我还是打算抽象一些封装基于 STL 容器上做
|