Thread overview
templates and functions
Sep 08, 2011
Daniel
Sep 08, 2011
Simen Kjaeraas
Sep 30, 2011
Steve Teale
September 08, 2011
Hi,

I'm trying to reimplement something like this C++ code in D:

template<Class T>
Class A {
   ...
}

template<Class T>
A<T> some_function() {
   ...
}

While I can implement the class:

class A(X) {
   ...
}

I fail with the function, due to the fact that I don't know/find the correct syntax for this. The version

A(X) some_function() {

}

fails with the message
function declaration without return type. (Note that constructors are always
named 'this')
which is understandable. Any idea how the correct syntax is?

Thanx, daniel
September 08, 2011
On Thu, 08 Sep 2011 18:52:52 +0200, Daniel <daniel.lincke@pik-potsdam.de> wrote:

> Hi,
>
> I'm trying to reimplement something like this C++ code in D:
>
> template<Class T>
> Class A {
>    ...
> }
>
> template<Class T>
> A<T> some_function() {
>    ...
> }
>
> While I can implement the class:
>
> class A(X) {
>    ...
> }
>
> I fail with the function, due to the fact that I don't know/find the correct
> syntax for this. The version
>
> A(X) some_function() {
>
> }
>
> fails with the message
> function declaration without return type. (Note that constructors are always
> named 'this')
> which is understandable. Any idea how the correct syntax is?
>
> Thanx, daniel

This newsgroup is deprecated. Please use digitalmars.D.learn instead.

-- 
  Simen
September 30, 2011
Simen,

We're all deprecated sooner or later - some of us sooner than others.

One gets the feeling that there is a politburo that controls D. Could you be so good as to publish the names of the central committee?

You sound like somebody out of Kafka - lighten up!

Steve