Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-10-28 22:06:18

E. Gladyshev wrote:

> --- Eric Friedman <ebf_at_[hidden]> wrote:
> [...]
>>I have also been considering the following syntax:
>> apply_visitor( fail_if<T>(vis), var );
> Looks fine to me. I think we understand what the problem is.
> Even if other compilers work, I definitely don't
> want to polute my visitors with the boost::empty overloads.
> Whether it is fail_if<> or cannot_visit<>,
> I trust your decision on how to solve this.

Yes, I'll try to get something working by the end of the week.

> Is there any chance to get it into v1.31?


>>Note as well that the upcoming type_switch will allow the following:
>> R result = switch_<R>(var)
>> |= case_<boost::empty>
>> ( throw_some_exception() )
>> |= default_
>> ( do_something() )
>> ;
>>where, of course, 'throw_some_exception' and 'do_something' would be
>>replaced by names of actual user-defined visitors or function objects.
> The type switch is very cool!
> But I don't see how it would help in my case?
> The visitor doesn't have the whole variant handy,
> It gets types controlled by a variant
> not the variant itself.
> So how do you use switch_<> in your visitor?

You don't; you use switch_ instead of apply_visitor. The chain of case_
statements creates a visitor that is then called by switch_.

Anyhow, type_switch certainly *won't* be in 1.31.


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