basically, I have something like this:
Code:
struct foo
{ };
void
bar( foo const & lhs, foo const & rhs )
{ }
template < typename Lhs >
void
bar( Lhs const & lhs, foo const & rhs )
{ }
template < typename Rhs >
void
bar( foo const & lhs, Rhs const & rhs )
{ }
struct baz : foo
{ };
int
main( void )
{
bar( foo( ), foo( ) ); // fine
bar( 1024, foo( ) ); // fine
bar( foo( ), 1024 ); // fine
bar( baz( ), baz( ) ); // error: ambiguous overload
bar( 1024, baz( ) ); // fine
bar( baz( ), 1024 ); // fine
}
it's really not clear to me why the compiler doesn't choose bar( foo const &, foo const & ) as the closest match. is there a workaround for this, or will I have to wait for c++0x to implement a 'where' clause?