From: Eric Friedman (ebf_at_[hidden])
Date: 2003-10-28 19:54:14
E. Gladyshev wrote:
> I have done a quick test.
> struct test_t
> template< typename T, typename U > void f( T& , U& );
> template<typename U> void f( int&, U& );
> template<typename T> void f( T&, int& );
> test_t m;
> void* p;
> int n;
> m.f(p, n);
> Got the following error:
> 'f' : none of 2 overload have a best conversion
> 'f' : ambiguous call to overloaded function
> I don't think that the overloading solution will work for
> binary visitors.
What compiler are you using? (I'd guess MSVC6/7.) Anyhow, a workaround
is possible for these broken compilers.
I have also been considering the following syntax:
apply_visitor( fail_if<T>(vis), var );
Note as well that the upcoming type_switch will allow the following:
R result = switch_<R>(var)
( throw_some_exception() )
( do_something() )
where, of course, 'throw_some_exception' and 'do_something' would be
replaced by names of actual user-defined visitors or function objects.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk