Default argument for templatized function

llewelly@xmission.com llewelly@xmission.com
Thu May 13 01:03:00 GMT 2004


Adrian Bentley <adruab@voria.com> writes:

> Ok so here's my problem, I have this templatized class (with T).  And
> for it I'm defining a templatized member function (with F), I want the
> function to take a comparison operation as a member to make it more
> flexible.
> 
> I'm defining:
> 
> template < typename T >
> class myclass
> {
> public:
>         template < typename F >
>         bool valid(const F & func = std::less<T>()) const
[snip]

14.8.2.4/17:

    # A template type-parameter cannot be deduced from the type of a
    # function default argument.

It then continues with an example much like yours.



More information about the Gcc-help mailing list