差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
cgfs:shaded_triangles [2025/12/12 15:47] – Replace repeated use std::copy with std::merge and overused auto with explicit type declaration freemikancgfs:shaded_triangles [2025/12/12 15:57] (現在) – Replace overused back_inserters freemikan
行 105: 行 105:
     assert(h01.size() + h12.size() == h02.size());     assert(h01.size() + h12.size() == h02.size());
  
-    std::vector<float> x012; +    std::vector<float> x012(x01.size() + x12.size())
-    std::merge(x01.begin(), x01.end(), x12.begin(), x12.end(), +    std::merge(x01.begin(), x01.end(), x12.begin(), x12.end(), x012.begin());
-               std::back_inserter(x012));+
  
-    std::vector<float> h012; +    std::vector<float> h012(h01.size() + h12.size())
-    std::merge(h01.begin(), h01.end(), h12.begin(), h12.end(), +    std::merge(h01.begin(), h01.end(), h12.begin(), h12.end(), h012.begin());
-               std::back_inserter(h012));+
  
     assert(x012.size() == x02.size());     assert(x012.size() == x02.size());
行 128: 行 126:
     }     }
  
-    auto h_segment = std::vector<float>();+    std::vector<float> h_segment;
  
     for (int y = yi0; y <= yi2; ++y) {     for (int y = yi0; y <= yi2; ++y) {
文書の先頭へ