Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-01-14 20:34:01


AMDG

Joel de Guzman wrote:
> Steven Watanabe wrote:
>
>> My concern is
>> 1) fall-through can't easily be added to the interface.
>>
>
> I have an idea I'd like to post in another update to the
> case concept.
>
Great.

> The point is that it is just another case. Whatever the
> sequenced_case is, it's just a model of the case concept.
> Sure it still has to be documented, but not as a separate
> concept, but as a model of it.
>
> Also, to me, it's most trivial to just make it an ET
> tree:
>
> template< class CaseL, class CaseR >
> struct binary_case
> {
> CaseL l;
> CaseR r;
>
> binary_case(CaseL const& l, CaseR const& r)
> : l(l), r(r) {}
>
> typedef mpl::joint_view<
> typename CaseL::labels, typename CaseR::labels
> > labels;
>
> template< typename Result, class I >
> Result apply(I);
> };
>
> Key points:
>
> * apply is part of the concept. In this case, it dispatches
> to l or r depending on I
>
> * hmmm.... maybe labels should be an mpl set.
>

No, thank you. mpl set is buggy and slow.

Also, one thing that needs to be nailed down is: What Is I?
Tobias was using it as the index into the list of labels:
   mpl::int_<0>, mpl::int_<1>, mpl::int_<2>, ...
In my original interface and as you seem to be using it I is one of:
   mpl::at_c<labels, 0>::type, mpl::at_c<labels, 1>::type,
mpl::at_c<labels, 2>::type

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net