From 1f102e4d9d8fe63455743f7f440550e89e501f12 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:44:42 +0200 Subject: [PATCH] Trying to get ROOT 6.32.0 to digest the type --- .../include/CommonDataFormat/AbstractRef.h | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/DataFormats/common/include/CommonDataFormat/AbstractRef.h b/DataFormats/common/include/CommonDataFormat/AbstractRef.h index 8dce94d502ffb..403bab3cbd62f 100644 --- a/DataFormats/common/include/CommonDataFormat/AbstractRef.h +++ b/DataFormats/common/include/CommonDataFormat/AbstractRef.h @@ -20,9 +20,7 @@ #include "GPUCommonRtypes.h" #include "GPUCommonTypeTraits.h" -namespace o2 -{ -namespace dataformats +namespace o2::dataformats { template @@ -32,8 +30,19 @@ class AbstractRef static constexpr auto MVAR() { static_assert(NBIT <= 64, "> 64 bits not supported"); - typename std::conditional<(NBIT > 32), uint64_t, typename std::conditional<(NBIT > 16), uint32_t, typename std::conditional<(NBIT > 8), uint16_t, uint8_t>::type>::type>::type tp = 0; - return tp; + if constexpr (NBIT > 32) { + uint64_t tp = 0; + return tp; + } else if constexpr (NBIT > 16) { + uint32_t tp = 0; + return tp; + } else if constexpr (NBIT > 8) { + uint16_t tp = 0; + return tp; + } else { + uint8_t tp = 0; + return tp; + } } public: @@ -87,7 +96,6 @@ class AbstractRef ClassDefNV(AbstractRef, 1); }; -} // namespace dataformats -} // namespace o2 +} // namespace o2::dataformats #endif