>From: "Vladimir Prus" <[EMAIL PROTECTED]>

> Pavol Droba wrote:
>
> > I have following two variants of the same function:
> >
> >     // find_first sequence const version
> >     template< typename InputT, typename SearchT >
> >     inline iterator_range< typename InputT::const_iterator >
> >     find_first( const InputT& Input, const SearchT& Search )
> >     {
> > ...
> >     }
> >
> >     // find_first sequence non-const version
> >     template< typename InputT, typename SearchT >
> >     inline iterator_range< typename InputT::iterator >
> >     find_first( InputT& Input, const SearchT& Search )
> >     {
> > ...
> >     }
> >
> > According to C++ standard it is perfectly legal to have these
> > two variants and feature known as "function template ordering"
> > does the job of choosing the right variant according to an input.
>
> Strictly speaking, I believe that's overload resolution which selects
> the right one.

Well, in the case of function templates, partial ordering of function
templates may be used to determine which overloaded template to use, so both
are right. :) In this case, the first template is more specialised than the
second (due to the const).


Regards,

Terje

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to