translate C++ template into D2

BLS nanali at nospam-wanadoo.fr
Mon May 5 10:48:20 PDT 2008


BLS schrieb:
> Hi, I'd like to ask how to translate this piece of C++ source.
> -code
> template <class T> class Lisp;
> 
> template <class T> Lisp<T>  lisp(const T& x1);
> template <class T> Lisp<T>  lisp(const T& x1, const T& x2);
> template <class T> Lisp<T>  lisp(const T& x1, const T& x2, const T& x3);
> template <class T> Lisp<T>  lisp(const T& x1, const T& x2, const T& x3, 
> const T& x4);
> 
> -end code
> 


> further :
> 
> template <class T> Lisp<T> lispn(const T& x, int n);
>     
> template <class T> Lisp<T> cons(const T& t);
> template <class T> Lisp<T> cons(const T& t, const Lisp<T>& list);
>     
> template <class T> class Lisp  ...........
> 
> 
> eof C++
> I hope it is possible to build something in D 2 by using :
> 
> class Lisp(const T..., I dunno )
> Is it possible ?,  How to implement ?
> Many many thanks in advance !
> Bjoern

or

class Lisp(const T...) (T t)
{
   private const t[] Cell;
}
????


More information about the Digitalmars-d-learn mailing list