Library standardization

e-t172 e-t172 at akegroup.org
Sun Apr 20 07:07:04 PDT 2008


Edward Diener a écrit :
> Is there an example of code separated into "headers" and 
> "implementation" ? I do not realize how this can be done. Can one just 
> declare a D function or class in a "header" and then import that file 
> and provide an implementation for what had previously just been declared 
> ? What about templates ? I do not see how a D template can just be 
> declared in one .d file and then implemented in another .d file.

I'm not sure - I think this would work :

class Foo
{
	void bar();
	int bar2();
	...
}

This would be in the .di file, with the actual implementation of bar() 
and bar2() in the corresponding .d file. Like C.

Templates are a special case. Templates are compile-time code, they 
cannot be "compiled". So their implementation is not stripped in the .di 
file.



More information about the Digitalmars-d mailing list