Aliasing specialized template stuct in his module leads troubles

Ivan Agafonov armadil at yandex.ru
Tue Sep 4 15:46:34 PDT 2012


I have my library module:
========================================================
module mylib.vector;

// alias Vector!(float, 4) Vector4f;

struct Vector(T, uint size)
{
	T[size] array = 0;
	...
}
========================================================

And I have client module:
========================================================
import mylib.vector;

alias Vector!(float, 4) Vector4f;
	
void main()
{
	auto x = Vector4f([1.0f, 2.0f, 3.0f, 4.0f]);
}
========================================================

If alias would be in vector module (commented there) I will have 
to compile
both modules (otherwise I'll get link errors for some vector 
functions), but I want to simply import vector module and 
immediately use predefined aliases for vector template struct. 
How can I do this?


More information about the Digitalmars-d-learn mailing list