Pseudo namespaces
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Fri Dec 4 12:08:00 PST 2015
On 2015-12-04 15:00, Andrei Alexandrescu wrote:
> How would one create a module inside a class or struct? -- Andrei
Hmm, I see that I really didn't understand what you were trying to do.
So you want to create a namespace inside a class or struct? I would
probably create a separate struct and return that from a function
struct List(T)
{
static struct Stable
{
void fun(int x) { }
}
auto stable() { return Stable(); }
}
List!(int) list;
list.stable.fun(2);
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list