I have some template clases, diferents types of list really, and i need to implement a method called "traduct" that has to return a pointer to a certain element in the list
traduct applied to this class should retorn a pointer to the struct
namespace std
{
//typedef struct PosicionS;
template <typename Type> class ListaPosicionada_DoubleLinked
{
private:
struct Posicion
{
Type elemento;
Posicion* anterior;
Posicion* siguiente;
public:
Posicion( const Type& elemento, Posicion* next = nullptr, Posicion* back = nullptr )
: elemento(elemento)
, anterior(back)
, siguiente(next)
{}
};
and here is the declaration traduct located in the main:
template <template <typename> class Lista, typename Type, struct posicion>
Lista<Type>::posicion& traduct( Type& elemento )
{
...
}
a get this errors after compilation:
error: 'struct posicion' is not a valid type for a template non-type parameter
template <template <typename> class Lista, typename Type, struct posicion>
^
error: need 'typename' before 'Lista<Type>::posicion' because 'Lista<Type>' is a dependent scope
Lista<Type>::posicion traducir( Type& elemento )
^
what is the correct form to return a pointer of the struct, should I implement a typedef to do the trick?