http://d.puremagic.com/issues/show_bug.cgi?id=10663
Summary: Mixin int not converting Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: trivial Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: alienballa...@gmail.com --- Comment #0 from Mariusz GliwiĆski <alienballa...@gmail.com> 2013-07-17 17:10:51 PDT --- I know i should minimise it more, but i'm too tired already. And dpaste just stopped working :( DMD v2.063.2 [CODE] import std.conv; struct StateRunning{} struct StateDisposer{} template Declaration(uint idx, T) { enum Declaration = "const("~T.stringof~")* _s"~idx~";"; //text("const(",T.stringof,")* _s",idx,";"); } template DeclarationMulti(T...) { template Loop(string ret,size_t i,Args...) { static if( Args.length == 0 ) { enum Loop = ret; } else { enum Loop = Loop!(ret~Declaration!(i,Args[0])~"\n", i+1, Args[1..$]); } } enum DeclarationMulti = Loop!("",0,T); } struct State(T...) { mixin(DeclarationMulti!(T)); void test(T args) { foreach( i, arg; args ) { mixin("_s"~to!string(i)) = &arg; } } } void main(string[] args) { StateRunning r; StateDisposer d; State!(StateRunning,StateDisposer) s; s.test(r,d); } [/CODE] -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------