http://d.puremagic.com/issues/show_bug.cgi?id=9847


Iain Buclaw <ibuc...@ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuc...@ubuntu.com


--- Comment #1 from Iain Buclaw <ibuc...@ubuntu.com> 2013-03-31 14:21:18 PDT ---
Further reduction:

----
import std.array;

template MsgMixin()
{
  mixin annotStructMembers!(MsgHeader.init);
}

template MsgReqMixin(T ...)
{
  mixin MsgMixin!T;
}

template annotStructMembers(T ...)
{
  mixin(mixinMembers!T);
}

struct MsgHeader
{
  alias uint tProcId;
  alias uint tNodeId;
  const PROC_INVALID = 0;
  tProcId m_procId = PROC_INVALID;
  tNodeId NODE_SELF;

  this(procId, tNodeId) {}
}

struct MsgLogFlush
{
  mixin MsgReqMixin;
}

Ret[] iterAnnotStruct(Ret, alias Op, int index, string member, T ...)()
{
  return [Op!(index, member, T).value];
}

string mixinMembers(T ...)()
{
  struct Op(V ...) {
      const value = V[0].stringof ~ V[1] ~ " = " ~ V[2].stringof;
  }
  return join(iterAnnotStruct!(string, Op, 0, "", T));
}
----


Regards
Iain

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to