Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-08-13 12:34:36


Thorsten Ottosen wrote:
> "Daniel Frey" <daniel.frey_at_[hidden]> wrote in message news:cfhteq$piv$1_at_sea.gmane.org...
>
> |Hm, good point. The only "solution" I could come up with is shown below,
> |but I don't know how portable/robust it is.
>
> |
> | template< typename T >
> | internal f( const T& x )
> | {
> | if( sizeof( f(x),internal() ) == sizeof( char ) ) {
> | // Non-ADL-implementation
> | std::cout << 1 << std::endl;
> | }
> | else {
> | // ADL-forwarder
> | f( x );
> | }
> | return internal();
> | }
>
> why do you return an internal here? I mean, weed want to return f(x).

But we need to detect which f(x) is choosen in the sizeof. The ADL f(x)
won't return internal, thus the operator, isn't applied, thus the
sizeof( f(x),internal() ) is not sizeof( char ). How else could you
detect which f(x) would be choosen? The above example also "wants" to
return void, thus it should work. For non-void return types, the class
'internal' must be more complicated.

But maybe someone else has a better (and robust enough) idea how to
detect which f(x) would be called...

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk