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

Template and typename

P: n/a
Hi all:

I have the template class:

template<typename InfoTabla> class TablaBusqueda {
typename InfoTabla::Tabla TipoTabla;
typename InfoTabla::Registro TipoRegistro;
typename InfoTabla::TipoClave TipoClave;
typedef map<TipoClave,TipoRegistro> Tabla; //line 9

...
};

When I compile I get the error:

hdrs/BDNotifUssd.h:9: error: invalid use of member `
ussd::TablaBusqueda<InfoTabla>::TipoClave'
I want to create a map with template parameters from TablaBusqueda
template parameter.

What is wrong?

Thanks in advance
Mar 30 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
kkk
I believe you have forgot to write typedef before typename.
use the following statements:
typedef typename InfoTabla::Tabla TipoTabla;
typedef typename InfoTabla::Registro TipoRegistro;
typedef typename InfoTabla::TipoClave TipoClave;
typedef map<TipoClave,TipoRegistro> Tabla; //line 9

You have to pass a data type in map template arguments.
using just typename InfoTabla::Tabla TipoTabla; will assume that you
have defined a variable named TipoTabla with type InfoTable::Table.

Carlos Martinez Garcia wrote:
Hi all:

I have the template class:

template<typename InfoTabla> class TablaBusqueda {
typename InfoTabla::Tabla TipoTabla;
typename InfoTabla::Registro TipoRegistro;
typename InfoTabla::TipoClave TipoClave;
typedef map<TipoClave,TipoRegistro> Tabla; //line 9

...
};

When I compile I get the error:

hdrs/BDNotifUssd.h:9: error: invalid use of member `
ussd::TablaBusqueda<InfoTabla>::TipoClave'
I want to create a map with template parameters from TablaBusqueda
template parameter.

What is wrong?

Thanks in advance


Mar 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.