]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/random/discrete_distribution.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / random / discrete_distribution.hpp
index 9574cbcae5c1b12e09eca3ad79a4231acc74e29f..c6c25fe8220dbcd39dccdfd569facf4526ea25a0 100644 (file)
@@ -571,8 +571,12 @@ private:
     template<class Iter>
     void init(Iter first, Iter last, std::forward_iterator_tag)
     {
+        size_t input_size = std::distance(first, last);
         std::vector<std::pair<WeightType, IntType> > below_average;
         std::vector<std::pair<WeightType, IntType> > above_average;
+        below_average.reserve(input_size);
+        above_average.reserve(input_size);
+        
         WeightType weight_average = _impl.init_average(first, last);
         WeightType normalized_average = _impl.get_weight(0);
         std::size_t i = 0;