On Tuesday, 4 September 2012 at 22:46:00 UTC, Ivan Agafonov wrote:
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?
I've encountered the exact same problem.
I create an alias to define a specific type out of a template in
the same library module that the template resides in. I can build
the library OK, but when I build an executable and link in the
library, the linker chokes out with an undefined symbol names.
If I comment out the alias, and instead define the same alias in
each module where it is being used, I can rebuild my library and
the executable OK.
This looks like a bug to me. The mystery is why almost no one is
complaining about it, so it must be that just about nobody
defines template aliases in this way.
I'll wait a while to see if there are any more comments before
filing a bug report
--rt