CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #7
    Join Date
    Apr 2003
    Location
    Morelia, Mexico
    Posts
    40

    Re: new way of overloading operators in templates??

    I found out. The correct code is:

    Code:
    #ifdef _MSC_VER 
    	friend CMatriz<TG> operator+(const TG &op1,const CMatriz<TG> &op2); // objeto TG + CMatriz
    	friend CMatriz<TG> operator+(const double &op1,const CMatriz<TG> &op2); // constante + CMatriz
    #elif __GNUC__ > 3 || (__GNUC__==3 && __GNUC_MINOR__ >=4)
    	friend CMatriz<TG> (::operator+ <TG>)(const TG &op1,const CMatriz<TG> &op2); // objeto TG + CMatriz
    	friend CMatriz<TG> (::operator+ <TG>)(const double &op1,const CMatriz<TG> &op2); // constante + CMatriz
    #else
    	friend CMatriz<TG> operator+ <>(const TG &op1,const CMatriz<TG> &op2); // objeto TG + CMatriz
    	friend CMatriz<TG> operator+ <>(const double &op1,const CMatriz<TG> &op2); // constante + CMatriz
    #endif
    The code I was after is the one meant for gcc>=3.4, that however won't compile in 3.3

    Any idea as to what does the new code means?
    Last edited by Luis G; June 30th, 2006 at 03:50 PM.
    int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
    o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured