Boost logo

Boost :

Subject: Re: [boost] Yap's formal review is starting now!
From: Peter Dimov (lists_at_[hidden])
Date: 2018-02-16 22:26:38

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) {


    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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at