C♯相談室 Part4
■ このスレッドは過去ログ倉庫に格納されています
0312デフォルトの名無しさん
NGNG多次元の添字のためのクラス作って、そいつをキーとする HashTable を使うとか。
struct Indeses
{
public int x, y;
public Indeses(int x, int y){this.x = x; this.y=y;}
static bool operator==(Indeses a, Indeses b){return a.x==b.x || x.y==b.y;}
}
HashTable hash = new HashTable()
hash[new Indeses(1, 2)] = 5;
って感じ。
あんまりスマートな方法じゃないけどな。
■ このスレッドは過去ログ倉庫に格納されています