On 3/5/12 11:07 AM, Ellery Newcomer wrote:
import multi_index; import replace;template RBTreeZ(Value, Preds...){ template Splat(size_t i, size_t N){ static if(i >= N) enum Splat = ""; else{ enum Splat = Replace!(q{ OrderedUnique!("a", Preds[$i]), }, "$i",i) ~ Splat!(i+1, N); } } enum ss = (Replace!( q{ alias MultiIndexContainer!(Value, IndexedBy!($indeces)) RBTreeZ; }, "$indeces",Splat!(0,Preds.length))); mixin(ss); } void main(){ alias RBTreeZ!(int, "a<b", "a>b") MahRBTree; // it compiles; good enough for me }
That's pretty cool. We should define easier ways to do this kind of stuff. Andrei
