@@ -39,10 +39,14 @@ namespace o2::framework
3939 * Static helper class to fill root histograms of any type. Contains functionality to fill once per call or a whole (filtered) table at once.
4040 */
4141// **************************************************************************************************
42+ template <typename T>
43+ concept FillValue = std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_enum_v<T>;
44+
4245struct HistFiller {
4346 // fill any type of histogram (if weight was requested it must be the last argument)
4447 template <typename T, typename ... Ts>
45- static void fillHistAny (std::shared_ptr<T> hist, const Ts&... positionAndWeight);
48+ static void fillHistAny (std::shared_ptr<T> hist, Ts... positionAndWeight)
49+ requires(FillValue<Ts> && ...);
4650
4751 // fill any type of histogram with columns (Cs) of a filtered table (if weight is requested it must reside the last specified column)
4852 template <typename ... Cs, typename R, typename T>
@@ -127,7 +131,8 @@ class HistogramRegistry
127131
128132 // fill hist with values
129133 template <typename ... Ts>
130- void fill (const HistName& histName, Ts&&... positionAndWeight);
134+ void fill (const HistName& histName, Ts... positionAndWeight)
135+ requires(FillValue<Ts> && ...);
131136
132137 // fill hist with content of (filtered) table columns
133138 template <typename ... Cs, typename T>
@@ -197,7 +202,8 @@ class HistogramRegistry
197202// --------------------------------------------------------------------------------------------------
198203
199204template <typename T, typename ... Ts>
200- void HistFiller::fillHistAny (std::shared_ptr<T> hist, const Ts&... positionAndWeight)
205+ void HistFiller::fillHistAny (std::shared_ptr<T> hist, Ts... positionAndWeight)
206+ requires(FillValue<Ts> && ...)
201207{
202208 constexpr int nArgs = sizeof ...(Ts);
203209
@@ -412,11 +418,16 @@ uint32_t HistogramRegistry::getHistIndex(const T& histName)
412418}
413419
414420template <typename ... Ts>
415- void HistogramRegistry::fill (const HistName& histName, Ts&&... positionAndWeight)
421+ void HistogramRegistry::fill (const HistName& histName, Ts... positionAndWeight)
422+ requires(FillValue<Ts> && ...)
416423{
417- std::visit ([& positionAndWeight...](auto && hist) { HistFiller::fillHistAny (hist, std::forward<Ts>( positionAndWeight) ...); }, mRegistryValue [getHistIndex (histName)]);
424+ std::visit ([positionAndWeight...](auto && hist) { HistFiller::fillHistAny (hist, positionAndWeight...); }, mRegistryValue [getHistIndex (histName)]);
418425}
419426
427+ extern template void HistogramRegistry::fill (const HistName& histName, double );
428+ extern template void HistogramRegistry::fill (const HistName& histName, float );
429+ extern template void HistogramRegistry::fill (const HistName& histName, int );
430+
420431template <typename ... Cs, typename T>
421432void HistogramRegistry::fill (const HistName& histName, const T& table, const o2::framework::expressions::Filter& filter)
422433{
0 commit comments