Belle II Software  release-08-01-10
SVDHoughTrackingHelpers.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 
11 namespace Belle2 {
16  namespace vxdHoughTracking {
17 
23  template<class T>
24  void checkResizeClear(std::vector<T>& vectorToCheck, uint limit)
25  {
26 
27  if (vectorToCheck.capacity() > limit) {
28  B2DEBUG(29, "Capacity of vector too large, create fresh vector and swap.");
29  std::vector<T> tmp;
30  std::swap(vectorToCheck, tmp);
31  tmp.clear();
32  }
33  vectorToCheck.clear();
34  vectorToCheck.reserve(limit / 10);
35  }
36 
37  }
39 }
void checkResizeClear(std::vector< T > &vectorToCheck, uint limit)
Check capacity of a vector and create a fresh one if capacity too large If the capacity of a std::vec...
Definition: Helpers.h:23
Abstract base class for different kinds of events.