On Fri, Feb 16, 2018 at 4:26 PM, Peter Dimov via Boost < boost@lists.boost.org> wrote:
Zach Laine wrote:
In this case, something like the expression_tag<> scheme Peter recommended helps with this particular ambiguity:
template
auto operator()(expression_tag<Tag>, T &&... t) What I suggested was rather
template
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` is more regular and easier to manipulate in a generic manner) but that might be too much of a change.
I'm vaguely embarrassed that it didn't already work this way. I've made
this change on the boost_review branch, and the recursive case of the
get_arity example transform is now:
template