|
Boost Users : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-01-14 13:49:22
AMDG
Joel de Guzman wrote:
> Tobias Schwinger wrote:
>
>
>>>> (c0,c1,...,cN) being just another 'Case' rather than a 'Sequence'.
>>>>
>>> o..k... Hmm.. so how would the resulting case object for this
>>> expression look like:
>>>
>>> case_c<1>(f1), case_c<2>(f2)
>>>
>>> ?
>>>
>> template< class SeqCases >
>> struct sequenced_case
>> {
>> <snip>
>>
>
> Sounds good to me! I like it. So, this involves the variation where
> a case has an MPL sequence of labels. I knew there's something in
> that that I like. Intuition, I guess. That is also why I use the
> name case_ regardless of number. A compound case is just another
> case anyway. Does not matter how many labels it serves.
>
> Not sure how, implementation-wise, this works for Steven. Steven?
> If this pans out, I'll refine the concept one more time.
>
It's trivial to implement:
#define BOOST_SWITCH_CASE(z, n, data)\
case mpl::at_c<typename C::labels, n>::type::value:
return(c.apply<R>(mpl::int_<n>()));
My concern is
1) fall-through can't easily be added to the interface.
2) It seems like just another interface for a fusion sequence.
Is sequenced_case to be public? If so, we need another
concept for its interface...
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