Topic: Partial overloading ambiguity or not (Defect?)
Author: fvali@my-deja.com
Date: 1999/12/12 Raw View
Does anyone know whether the first sort function is more
specialized than the second one -
template <typename TY_ >
void sort( TY_
, typename matrix< typename TY_::matrix_ptype >::row_t
);
template< typename TY_ > void sort( TY_, TY_ );
gcc-2.95 doesn;t seem to think so - and i'm not exactly sure
what the standard thinks (since i don;t have access to one
temporarily - and i forget the partial overloading rules).
#include <iostream>
template<
typename TY_
>
struct matrix
{
struct row_t
{
typedef TY_ matrix_ptype;
};
typedef int jim;
row_t row() { return row_t(); }
};
template <typename TY_ >
void sort( TY_
, typename matrix< typename TY_::matrix_ptype >::row_t
)
{
std::cout << "specialized one" << std::endl;
}
template< typename TY_ > void sort( TY_, TY_ ) //, typename TY_::jim k =
0 )
{
std::cout << "most generic" << std::endl;
}
int main()
{
matrix< int > m;
matrix< int > m2;
matrix< float > m3;
matrix<char> m4;
sort( m.row(), m2.row() );
}
Sent via Deja.com http://www.deja.com/
Before you buy.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]