前提・実現したいこと
C++において、
tupleを型としたvectorをsortするときに、
tupleの任意の要素を基準にsortをしたいです。
該当のソースコード
c++
1tuple<short, int, vector<short>> bdcheck(int n, short t, int b, int w){ 2 /* 略 */ 3 int s = cntsco(t, (t == 1) ? b : w); 4 5 tuple<short, int, vector<short>> back = make_tuple(n, s, vbd); 6 return back; 7} 8 9int osero(int b, int w){ 10 short bs = 2, ws = 2; 11 short turn = 1; 12 bool dp = false; 13 short winner; 14 /* 変数説明 15 bs, ws … 取得枚数 16 turn … 手番 17 dp … 二重パス判定 18 winner … 勝者 19 */ 20 21 init(); 22 23 while(1){ 24 if(bs + ws == 64) break; 25 vector<tuple<short, int, vector<short>>> can(32); // 置けるマスリスト 26 short pnt = 0; 27 rep(n, 64){ 28 try{ 29 tuple<short, int, vector<short>> x; 30 x = bdcheck(n, turn, b, w); 31 can[pnt] = x; 32 pnt++; 33 } 34 catch(int num){ 35 continue; 36 } 37 } 38 can.resize(pnt); 39 /* この後、tuple内のintを基準にソートをしたい */ 40 } 41}
試したこと
色々な解説を見てみましたが、どうやればいいかが分かりませんでした…
補足情報
コンパイラはMinGW6.3.0を使用しています。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。