@@ -1382,11 +1382,28 @@ using JoinBase = decltype(join(std::declval<Ts>()...));
13821382template <typename T1 , typename T2 >
13831383using ConcatBase = decltype (concat(std::declval<T1 >(), std::declval<T2>()));
13841384
1385- template <typename T1 , typename T2 >
1386- constexpr auto is_binding_compatible_v ()
1385+ template <typename B, typename E>
1386+ struct EquivalentIndex {
1387+ constexpr static bool value = false ;
1388+ };
1389+
1390+ template <typename B, typename E>
1391+ constexpr bool is_index_equivalent_v = EquivalentIndex<B, E>::value;
1392+
1393+ template <typename T, typename ... Os>
1394+ constexpr bool are_bindings_compatible_v (framework::pack<Os...>&&)
13871395{
1388- return framework::pack_size (
1389- framework::intersected_pack_t <originals_pack_t <T1 >, originals_pack_t <T2 >>{}) > 0 ;
1396+ if constexpr (is_type_with_originals_v<T>) {
1397+ return (are_bindings_compatible_v<Os>(originals_pack_t <T>{}) || ...);
1398+ } else {
1399+ return ((std::is_same_v<T, Os> || is_index_equivalent_v<T, Os>) || ...);
1400+ }
1401+ }
1402+
1403+ template <typename T, typename B>
1404+ constexpr bool is_binding_compatible_v ()
1405+ {
1406+ return are_bindings_compatible_v<T>(originals_pack_t <B>{});
13901407}
13911408
13921409} // namespace o2::soa
@@ -1397,6 +1414,12 @@ constexpr auto is_binding_compatible_v()
13971414 using metadata = std::void_t <T>; \
13981415 }
13991416
1417+ #define DECLARE_EQUIVALENT_FOR_INDEX (_Base_, _Equiv_ ) \
1418+ template <> \
1419+ struct EquivalentIndex <_Base_, _Equiv_> { \
1420+ constexpr static bool value = true ; \
1421+ }
1422+
14001423#define DECLARE_SOA_COLUMN_FULL (_Name_, _Getter_, _Type_, _Label_ ) \
14011424 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
14021425 static constexpr const char * mLabel = _Label_; \
@@ -1549,7 +1572,7 @@ constexpr auto is_binding_compatible_v()
15491572
15501573#define DECLARE_SOA_SLICE_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , _Name_##s, " " )
15511574
1552- // /ARRAY
1575+ // / ARRAY
15531576#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL (_Name_, _Getter_, _Type_, _Table_, _Suffix_ ) \
15541577 struct _Name_ ##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
15551578 static_assert (std::is_integral_v<_Type_>, " Index type must be integral" ); \
@@ -1628,7 +1651,7 @@ constexpr auto is_binding_compatible_v()
16281651
16291652#define DECLARE_SOA_ARRAY_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , _Name_##s, " " )
16301653
1631- // /NORMAL
1654+ // / NORMAL
16321655#define DECLARE_SOA_INDEX_COLUMN_FULL (_Name_, _Getter_, _Type_, _Table_, _Suffix_ ) \
16331656 struct _Name_ ##Id : o2::soa::Column<_Type_, _Name_##Id> { \
16341657 static_assert (std::is_integral_v<_Type_>, " Index type must be integral" ); \
@@ -1701,7 +1724,7 @@ constexpr auto is_binding_compatible_v()
17011724
17021725#define DECLARE_SOA_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , _Name_##s, " " )
17031726
1704- // /SELF
1727+ // / SELF
17051728#define DECLARE_SOA_SELF_INDEX_COLUMN_FULL (_Name_, _Getter_, _Type_, _Label_ ) \
17061729 struct _Name_ ##Id : o2::soa::Column<_Type_, _Name_##Id> { \
17071730 static_assert (std::is_integral_v<_Type_>, " Index type must be integral" ); \
@@ -1808,7 +1831,7 @@ constexpr auto is_binding_compatible_v()
18081831 void const * mBinding = nullptr ; \
18091832 };
18101833
1811- #define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , #_Name_)
1834+ #define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , " _ " #_Name_)
18121835// / SELF ARRAY
18131836#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL (_Name_, _Getter_, _Type_, _Label_ ) \
18141837 struct _Name_ ##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
@@ -1867,7 +1890,8 @@ constexpr auto is_binding_compatible_v()
18671890 void const * mBinding = nullptr ; \
18681891 };
18691892
1870- #define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , #_Name_)
1893+ #define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN (_Name_, _Getter_ ) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL (_Name_, _Getter_, int32_t , " _" #_Name_)
1894+
18711895// / A dynamic column is a column whose values are derived
18721896// / from those of other real columns. These can be used for
18731897// / example to provide different coordinate systems (e.g. polar,
0 commit comments