1

I've been trying for quite a long time to pass a private struct, defined inside another struct, as a parameter to a function, but I always get the same error:

`cmt.h:17:85: error: expected identifier before ‘struct’
 template<typename C, typename D, typename T> bool existeClaveI(typename CMT<C,D,T>::struct Nodo *nodo, const C& clave);
cmt.h:17:85: error: expected ‘(’ before ‘struct’
cmt.h:17:104: error: expected primary-expression before ‘const’
 template<typename C, typename D, typename T> bool existeClaveI(typename CMT<C,D,T>::struct Nodo *nodo, const C& clave);´

My main struct is defined this way:

template<typename C, typename D, typename T> struct CMT{
    //friends...
    friend bool existeClave<C,D,T> (CMT<C,D,T>& cmt, const C& clave);
    friend bool existeClaveI<C,D,T> (typename CMT<C,D,T>::struct Nodo *nodo, const C& clave);

   private:
    struct Nodo{
        C clave;
        D dato;
        T tiempo;
        bool tieneTiempo;
        struct Nodo *izquierda;
        struct Nodo *derecha;
    };
    int numNodos;
    struct Nodo *raiz;
    Pila<struct Nodo*> iterador;
};

This is the function existeClaveI itself:

template<typename C, typename D, typename T>
bool existeClaveI(typename CMT<C,D,T>::struct Nodo *nodo, const C& clave){
...
}

How's the write way of specifying the parameters? Thanks a lot!!

pitazzo
  • 1,125
  • 1
  • 13
  • 28

0 Answers0