Any ideas why DMD2 cannot inline this, but LDC2 has no problem doing so
-- or suggestions for what I can do to make DMD2 inline it?
Alternatively, I could version(DigitalMars) and version(LDC), but AFAICT
this requires me to duplicate the entire template, because I cannot
figure out how to make the version() directive apply only to the pragma.
Template instantiation is with a simple struct having integer members
start and end.
Thanks in advance for tips.
---
pragma(inline, true)
bool overlaps(IntervalType1, IntervalType2)(IntervalType1 int1,
IntervalType2 int2)
if (__traits(hasMember, IntervalType1, "start") &&
__traits(hasMember, IntervalType1, "end") &&
__traits(hasMember, IntervalType2, "start") &&
__traits(hasMember, IntervalType2, "end"))
{
// int1 ===== =======
// int2 ======= =======
if (int2.start <= int1.start && int1.start < int2.end) return true;
// int1 ======= =======
// int2 === =======
else if (int1.start <= int2.start && int2.start < int1.end) return
true;
// int1 ===== | =====
// int2 ===== | =====
else return false;
}