Template and typename

  • Thread starter Carlos Martinez Garcia
  • Start date
C

Carlos Martinez Garcia

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
 
K

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top