Recursive Templates
llee
llee at goucher.edu
Sat Aug 9 10:40:24 PDT 2008
I'm working on a set library that uses templates. The library centers around a class named Set. This class contains an array named elems that stores the set's elements. The definition for set is as follows:
class Set (T) { ... T[] elems; ... }
To calculate the cartesian product of two sets, I need to be able to represent higher order sets. I tried defining a function with the following signiture:
static Set! (Set! (T)) product (Set! (T) a, Set! (T) b);
Unfortunately, the dmd compiler throws an error stating that It does no allow recursive elements.
Does anyone know how to work around this problem?
More information about the Digitalmars-d
mailing list