以下代码VC6编译不过,不知道fun(m1)调用那个函数,VC8能过。


#include <iostream>

#include <string>
#include <map>

using namespace std ;


void fun(int x)
    {
        
    }

template<class _K, class _Ty>
        void fun(std::map<_K,_Ty>& m)
    {
        
    }

    template<class TYPE>
    void fun(TYPE x)
    {
        
    }
 
    class A
    {
    };


    void main()
    {
        std::map<long, A> m1;
        fun(3);
        fun("dd");
        fun(m1);
    }

-------------------------------



template<class T>
void Fun(T t1,T t2 )
{
}

template<class T1,class T2 >
int Fun(T1 t1,T2 t2)
{
    return 0 ;
}


void main()
{
    int x1 = Fun((short)1,(long)1);
}


VS2005(VS8)能过 VS2002(VC7)不能过。


posted on 2016-03-03 10:04  闻缺陷则喜何志丹  阅读(1)  评论(0编辑  收藏  举报  来源