Converting some C++ code help.
Philippe Sigaud
philippe.sigaud at gmail.com
Thu Aug 2 11:31:38 PDT 2012
On Thu, Aug 2, 2012 at 7:59 PM, rookie <rookie at rooki.com> wrote:
> Hi,
>
> I have the following C++ code, what would be the equivalent D code;
IIRC, Test<T>::pop is a method definition, right ?
>
> template <class T>
> T Test<T>::pop(int ind)
> {
> T pop = T();
> // Stuff that not important
> //....
> return pop;
> }
in D, a free function would be:
T pop(T)(int ind)
{
T pop;
return pop;
}
and, in a class:
class Test(T)
{
T pop(int ind)
{
T pop;
return pop;
}
}
But then, my C++ is quite rusty, some I'm sure there are some gotchas
that I forgot.
More information about the Digitalmars-d-learn
mailing list