Template and typename



 DEVELOP > c-Plus-Plus > Template and typename

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Carlos Martinez Garcia"
Date: 30 Mar 2006 05:30:04 AM
Object: Template and typename
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
.

User: "kkk"

Title: Re: Template and typename 30 Mar 2006 07:24:42 AM
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

.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER