Closed kanra824 closed 4 years ago
vector<vector<edge>> G(n);
G[i].push_back({src, to, cost})
でコンストラクタなしで動くので、テンプレートを書く手間と天秤だな〜と思ってました。 https://github.com/habara-k/ICPCLibrary/blob/master/test/graph/dijkstra.cpp#L12
ライブラリには書いておいて、当日は書かなくても良いとわかるようにしておくのがいいかな...
struct edge {
int src, to;
T cost;
// edge(int src, int to, T cost): src(src), to(to), cost(cost) {}
// // G[i].push_back({src, to, cost}) requires no constructor
};
あー初期化子そういう場合にも使えるのか(普段そういう使い方しないから絶対{}忘れそう)
マージしちゃいます
graphテンプレート中にedgeのコンストラクタがなかったので追加した