@inverse
Daniel N via Digitalmars-d
digitalmars-d at puremagic.com
Wed Feb 25 13:25:47 PST 2015
Just throwing an idea out there... How about using annotations to
teach the compiler which functions are inverses of each-other, in
order to facilitate optimizing away certain redundant operations
even if they are located inside a library(i.e. no source).
A little pseudo-code for illustrational purposes, in case my
above text is incomprehensible:
void inc() pure nothrow @inverse(dec)
void dec() pure nothrow @inverse(inc)
void swap(T)(ref T lhs, ref T rhs) pure nothrow @inverse(swap!T)
More information about the Digitalmars-d
mailing list