
Thorsten Ottosen wrote:
namespace A { namespace detail { template< typename T > void f( const T& ) { std::cout << 1 << std::endl; }
template< typename T > void adl_f( const T& x ) { f( x ); } }
template< typename T > void f( const T& x ) { detail::adl_f( x ); }
// this is bad!! struct C {};
I assume you have control over namespace A, thus you can add: void f( const C& x ) { detail::f( x ); } and the problem is gone. Is this a feasible solution for you?
}
namespace B { class C {};
void f( const C& ) { std::cout << 2 << std::endl; } }
int main() { A::f( 42 );
A::C c0; A::f( c0 ); // error!
B::C c; A::f( c ); }
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@aixigo.de, web: http://www.aixigo.de