فهرست منبع

Merge topic 'cmList-regression'

a6e8811cf0 cmList: Fix performance regression in Join / to_string

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !8612
Brad King 2 سال پیش
والد
کامیت
7ad290bf9c
1فایلهای تغییر یافته به همراه6 افزوده شده و 7 حذف شده
  1. 6 7
      Source/cmList.h

+ 6 - 7
Source/cmList.h

@@ -1211,13 +1211,12 @@ private:
 
     const auto sep = std::string{ glue };
 
-    return std::accumulate(
-      std::next(std::begin(r)), std::end(r), cmList::ToString(*std::begin(r)),
-      [&sep](std::string const& a,
-             typename std::iterator_traits<decltype(std::begin(
-               r))>::value_type const& b) -> std::string {
-        return a + sep + cmList::ToString(b);
-      });
+    std::string joined = cmList::ToString(*std::begin(r));
+    for (auto it = std::next(std::begin(r)); it != std::end(r); ++it) {
+      joined += sep + cmList::ToString(*it);
+    }
+
+    return joined;
   }
 
   container_type Values;