fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. class Puntero {
  6. T* p_;
  7. public:
  8. Puntero(T* p = nullptr) : p_(p) {}
  9. T* operator->() { return p_; }
  10. ~Puntero() { delete p_; }
  11. };
  12.  
  13. template <class T>
  14. class NodoLista
  15. {
  16. public:
  17. T dato;
  18. Puntero<NodoLista<T>> sig;
  19. NodoLista<T>(const T& e, Puntero<NodoLista<T>> s) : dato(e), sig(s) { };
  20. };
  21. //template <class U>
  22. //typedef Puntero<NodoLista<U>> pNodoLista;
  23. template <class T>
  24. using pNodoLista = Puntero<NodoLista<T>>;
  25. int main()
  26. {
  27. pNodoLista<int> nodo = new NodoLista<int>(1, nullptr);
  28. cout<<nodo->dato<<endl;
  29. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
1