Skip to content

Instantly share code, notes, and snippets.

@xentec
Created December 30, 2015 15:30
Show Gist options
  • Save xentec/43334318afc7ef7d0655 to your computer and use it in GitHub Desktop.
Save xentec/43334318afc7ef7d0655 to your computer and use it in GitHub Desktop.
std.variant breaking
void buildVar(DBusMessageIter *iter, Variant var, int sig)
{
import std.meta;
alias basic = AliasSeq!(byte,bool,short,ushort,int,uint,long,ulong,double,string);
foreach(T; basic) {
T* p = var.peek!T;
if(p) {
buildIter!T(iter, *p);
break;
}
alias A = T[];
A* a = var.peek!A;
if(a) {
buildIter!A(iter, *a);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment