This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Default argument for templatized function
- From: llewelly at xmission dot com
- To: Adrian Bentley <adruab at voria dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 12 May 2004 19:03:10 -0600
- Subject: Re: Default argument for templatized function
- References: <1084315475.4815.19.camel@localhost>
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.