By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,483 Members | 1,612 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,483 IT Pros & Developers. It's quick & easy.

error: template-id does not match any template declaration

P: n/a
I have a class Feature defined, which is a kind of Vocab:

template <class T, unsigned I>
class Vocab : boost::totally_ordered<Vocab<T,I {
public:
Vocab();
Vocab(const T& t);
template<typename VVocab(V v, bool dummy);
....
};
typedef Vocab<string, 0Feature;

Then, I try to specialize (define?) the templated constructor:
template<>
inline Feature::Vocab(pair<parser::id_ty, stringp, bool dummy) {
...
}

This code compiles under g++ 3.4, but under g++ 4 I get the following
errors:

src/specialize-bdt.H:37: error: template-id 'Vocab<>' for
'bdt::Vocab<std::string, 0u>::Vocab(std::pair<parser::id_ty,
std::string>, bool)' does not match any template declaration
src/specialize-bdt.H:37: error: invalid function declaration

What is the problem here?

Thanks,
Joseph

Mar 22 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Joseph Turian wrote:
I have a class Feature defined, which is a kind of Vocab:

template <class T, unsigned I>
class Vocab : boost::totally_ordered<Vocab<T,I {
public:
Vocab();
Vocab(const T& t);
template<typename VVocab(V v, bool dummy);
....
};
typedef Vocab<string, 0Feature;

Then, I try to specialize (define?) the templated constructor:
template<>
inline Feature::Vocab(pair<parser::id_ty, stringp, bool dummy) {
...
}

This code compiles under g++ 3.4, but under g++ 4 I get the following
errors:

src/specialize-bdt.H:37: error: template-id 'Vocab<>' for
'bdt::Vocab<std::string, 0u>::Vocab(std::pair<parser::id_ty,
std::string>, bool)' does not match any template declaration
src/specialize-bdt.H:37: error: invalid function declaration

What is the problem here?
I don't think you can use 'Feature' to write the specialisation (but
I can be wrong). Have you tried

template<>
template<>
inline Vocab<string,0>::Vocab(pair<par....

?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 22 '07 #2

P: n/a
I don't think you can use 'Feature' to write the specialisation (but
I can be wrong). Have you tried

template<>
template<>
inline Vocab<string,0>::Vocab(pair<par....
Thanks for the advice. At least according to gcc, I can use Feature:
template<>
template<>
inline Feature::Vocab(pair<par....

The second "template<>" did the trick, so thanks! :)

Best,
Joseph

Mar 22 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.