Topic: Problem re-using template argument in template member function in GCC 3.2?
Author: dheld@codelogicconsulting.com ("David B. Held")
Date: Mon, 17 Feb 2003 17:21:02 +0000 (UTC) Raw View
"Bob Kurtz" <bkurtz@NOSPAM.com> wrote in message
news:gt8q4v8cftlpiv91ks2jtcrene9i5e1cai@4ax.com...
> [...]
> template<class DictKeyType>
> vector<Statement*>
> StatementContainer::getStatementsWithKeyValueImplementation(const
> string & keyNameString, const DictKeyType & valueToCheckFor) const
> {
> // ... Stuff omitted ...
> const bool currentStatementHasKeyValue =
> pCurrentStatementDict->hasKeyWithValue<typename
DictKeyType>(keyNameString,
> valueToCheckFor);
> // ... More stuff omitted
> }
I don't think it's valid to use 'typename' in this instance, because
DictKeyType is not a dependent name. Furthermore, I don't believe
it is necessary to specify the specialization parameter at all, since
hasKeyWithValue uses that type in a function argument. That is,
the type of valueToCheckFor should induce argument type deduction
to automatically selet DictKeyType for you. You should just be
able to write this:
pCurrentStatementDict->hasKeyWithValue(
keyNameString, valueToCheckFor
);
If you can't, there's some serious problems going on. Even if you had
to explicitly specify the temlate parameter, you would do so like this:
pCurrentStatementDict->hasKeyWithValue<DictKeyType>(
keyNameString, valueToCheckFor
);
Dave
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]