D言語 Part11
■ このスレッドは過去ログ倉庫に格納されています
0073デフォルトの名無しさん
2006/12/22(金) 07:49:22template getter(alias T){final typeof(T) getter(){return T;}}
template setter(alias T){final typeof(T) setter(typeof(T)value){return T=value;}}
template property_(alias T){alias getter!(T) v;alias setter!(T) v;}
template property(alias T){alias property_!(T).v property;}
struct Point{
int x_,y_;
alias property!(x_) x;
alias property!(y_) y;
}
void main(){
Point v;
v.x=100;
v.y=120;
printf("%d %d\n",v.x,v.y);
}
■ このスレッドは過去ログ倉庫に格納されています