2015-10-03 39 views

回答

2

D具有UDA s(用戶定義的屬性)。從文檔

舉例:他們是如何在cerealed使用

@(3) int a; 
@("string", 7) int b; 

enum Foo; 
@Foo int c; 

struct Bar 
{ 
    int x; 
} 

@Bar(3) int d; 

例子:

struct MyStruct { 
    ubyte mybyte1; 
    @NoCereal uint nocereal1; //won't be serialised 
    @Bits!4 ubyte nibble; 
    @Bits!1 ubyte bit; 
    @Bits!3 ubyte bits3; 
    ubyte mybyte2; 
} 

不幸的是,我無法找到任何GtkD提到的UDA的。

相關問題