Skip to content

Commit a262051

Browse files
committed
[TDF] Extract logic to select list of column types for custom columns
1 parent d824311 commit a262051

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

tree/treeplayer/inc/ROOT/TDFNodes.hxx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,10 @@ public:
368368
unsigned int GetNSlots() const { return fNSlots; }
369369
};
370370

371-
template <typename F, bool PassSlotNumber = false>
372-
struct CustomColumnBranchTypes {
373-
using type = typename CallableTraits<F>::arg_types;
374-
};
375-
376-
template <typename F>
377-
struct CustomColumnBranchTypes<F, true> {
378-
using type = RemoveFirstParameter_t<typename CallableTraits<F>::arg_types>;
379-
};
380-
381371
template <typename F, bool PassSlotNumber = false>
382372
class TCustomColumn final : public TCustomColumnBase {
383-
using BranchTypes_t = typename CustomColumnBranchTypes<F, PassSlotNumber>::type;
373+
using FunParamTypes_t = typename CallableTraits<F>::arg_types;
374+
using BranchTypes_t = typename TDFInternal::RemoveFirstParameterIf<PassSlotNumber, FunParamTypes_t>::type;
384375
using TypeInd_t = TDFInternal::GenStaticSeq_t<BranchTypes_t::list_size>;
385376
using ret_type = typename CallableTraits<F>::ret_type;
386377

tree/treeplayer/inc/ROOT/TDFUtils.hxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@ struct HistoUtils<T, true> {
261261
static bool HasAxisLimits(T &) { return true; }
262262
};
263263

264+
/// `type` is TypeList if MustRemove is false, otherwise it is a TypeList with the first type removed
265+
template <bool MustRemove, typename TypeList>
266+
struct RemoveFirstParameterIf {
267+
using type = TypeList;
268+
};
269+
270+
template <typename TypeList>
271+
struct RemoveFirstParameterIf<true, TypeList> {
272+
using type = RemoveFirstParameter_t<TypeList>;
273+
};
274+
264275
} // end NS TDF
265276
} // end NS Internal
266277
} // end NS ROOT

0 commit comments

Comments
 (0)