Advertisement
AntonyZhilin

Untitled

Jan 23rd, 2024
1,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.51 KB | None | 0 0
  1. Index: userver/core/src/utils/statistics/impl/histogram_view_utils.hpp
  2. IDEA additional info:
  3. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  4. <+>UTF-8
  5. ===================================================================
  6. diff --git a/userver/core/src/utils/statistics/impl/histogram_view_utils.hpp b/userver/core/src/utils/statistics/impl/histogram_view_utils.hpp
  7. --- a/userver/core/src/utils/statistics/impl/histogram_view_utils.hpp   (revision 74036559a71b8c0f7651f0638abb8e64259c080d)
  8. +++ b/userver/core/src/utils/statistics/impl/histogram_view_utils.hpp   (date 1706007217335)
  9. @@ -32,10 +32,9 @@
  10.  
  11.    template <typename AnyHistogramView>
  12.    static auto Bounds(AnyHistogramView view) noexcept {
  13. -    const auto bound_ref_getter = [](auto&& bucket) -> auto& {
  14. -      return bucket.upper_bound.bound;
  15. -    };
  16. -    return Buckets(view) | boost::adaptors::transformed(bound_ref_getter);
  17. +    return Buckets(view) |
  18. +           boost::adaptors::transformed(
  19. +               [](const Bucket& bucket) { return bucket.upper_bound.bound; });
  20.    }
  21.  
  22.    template <typename AnyHistogramView>
  23. @@ -97,7 +96,10 @@
  24.        UINVARIANT(*upper_bounds.begin(), "Histogram bounds must be positive");
  25.      }
  26.      buckets_[0].upper_bound.size = std::size(upper_bounds);
  27. -    boost::copy(upper_bounds, Access::Bounds(*this).begin());
  28. +    for (auto [bucket, bound] :
  29. +         boost::combine(Access::Buckets(*this), upper_bounds)) {
  30. +      bucket.upper_bound.bound = bound;
  31. +    }
  32.    }
  33.  
  34.    // Atomic for 'other', non-atomic for 'this'
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement