This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: eb42.C


Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:

>   template <class T >
>   inline bool compare(const Expr<T> a, const Expr<T> b){ return true; };
  
>   sort( a.begin(), a.end(), compare );

> Is the compiler really required to determine the parameter of compare?

No, it cannot be deduced because the types of the iterators and the
compare objects are unrelated in the `sort' template function
declaration.  Thus, template arguments for compare must be explicitly
specified.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]