CMS 3D CMS Logo

getFixedSizeArray.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_getFixedSizeArray_h
2 #define FWCore_ParameterSet_getFixedSizeArray_h
3 
6 
7 #include <algorithm>
8 #include <array>
9 #include <cstddef>
10 #include <string>
11 #include <vector>
12 
13 namespace edm {
14 
15  template<class T, std::size_t N>
16  std::array<T, N>
18  std::vector<T> vec = pset.getParameter<std::vector<T>>(name);
19  if (vec.size() != N) {
21  << "The parameter '" << name
22  << "' should have " << N << " elements, but has " << vec.size()
23  << " elements in the configuration.\n";
24  }
25  std::array<T, N> a {};
26  std::copy_n(vec.begin(), N, a.begin());
27  return a;
28  }
29 }
30 #endif
T getParameter(std::string const &) const
std::array< T, N > getFixedSizeArray(ParameterSet const &pset, std::string const &name)
#define N
Definition: blowfish.cc:9
HLT enums.
double a
Definition: hdecay.h:121