| 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
.
|
|
|
|

|
Related Articles |
|
|