Matthias Walter <[email protected]> wrote:
Can I handle this in another way (like making the template a conditional
one)?
Template constraints[1] sounds like what you want.
Basically, you want the following:
== Module a ==
| module a;
|
| template Base (T) if (!is(T t : t*))
| {
| alias T Base;
| }
== Module b ==
| module b;
|
| import a;
|
| template Base(T) if (is(T t : t*))
| {
| alias Base !(T) Base;
| }
== Main module ==
|
| import a, b;
|
| int main(char[][] args)
| {
| alias Base !(int*) foo;
|
| return 0;
| }
Not tested, ymmv.
[1]: http://digitalmars.com/d/2.0/template.html#Constraint
--
Simen