2 ms·
Boosts variant library has a solution to this problem http://www.boost.org/doc/libs/1_65_1/doc/html/variant/tutorial.html#variant.tutorial.recursive http://www
by nly 9y ago
Boosts variant library has a solution to this problem
http://www.boost.org/doc/libs/1_65_1/doc/html/variant/tutorial.html#variant.tutorial.recursive http://www.boost.org/doc/libs/1_65_1/doc/html/variant/tutori...
boost::variant<
int,
boost::recursive_wrapper<binary_op<add>>,
boost::recursive_wrapper<binary_op<sub>>
> expression;
When the visitor is applied, the recursive wrappers are unwrapped transparently.