
Zach Laine wrote:
In this case, something like the expression_tag<> scheme Peter recommended helps with this particular ambiguity:
template <typename Tag, typename... T> auto operator()(expression_tag<Tag>, T &&... t)
What I suggested was rather template <expr_kind Kind, typename... T> auto operator()(expression_tag<Kind>, T &&... t) as this enforces the necessary 1:1 correspondence between kinds and tags.
{ // and it also seems to help with writing targeted transforms in C++17: if (yap::to_kind<Tag>() == yap::expr_kind::terminal) {
Resp. if (Kind == yap::expr_kind::terminal) { There's an argument to be made in favor of making Expression take a Tag first parameter instead of the non-type Kind (`template<class...> class` is more regular and easier to manipulate in a generic manner) but that might be too much of a change.