本当は怖いHPC

HPC屋の趣味&実益ブログ

2016-08-23から1日間の記事一覧

std::tupleとstd::tieを使って複数の配列を一緒にソートする(配列の構造体 SoA のソート)

c++

互いに関連付けられた複数の配列を一緒にソートしたい場合があります. // SoAの例 std::vector<int> student_ids; std::vector<std::string> names; std::vector<int> math_scores; // AoSの例 struct Student { int id; std::string name; int math_score }; 専門的には,SoA(Str</int></std::string></int>…

【広告】