Skip to content

Commit 8246329

Browse files
committed
improve cursor conditions
1 parent 85d6729 commit 8246329

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ concept is_producable = soa::has_metadata<aod::MetadataTrait<T>> || soa::has_met
8989
template <is_producable T>
9090
struct WritingCursor {
9191
public:
92-
using persistent_table_t = decltype([]() { if constexpr (soa::is_iterator<T>) { return typename T::parent_t{nullptr}; } else { return T{nullptr}; } }()); // std::conditional<soa::is_iterator<T>, typename T::parent_t, T>;
92+
using persistent_table_t = decltype([]() { if constexpr (soa::is_iterator<T>) { return typename T::parent_t{nullptr}; } else { return T{nullptr}; } }());
9393
using cursor_t = decltype(std::declval<TableBuilder>().cursor<persistent_table_t>());
9494

9595
template <typename... Ts>
@@ -135,14 +135,16 @@ struct WritingCursor {
135135

136136
private:
137137
template <typename A>
138+
requires requires { &A::globalIndex; }
138139
static decltype(auto) extract(A const& arg)
139140
{
140-
if constexpr (requires(T t) { t.globalIndex(); }) {
141-
return arg.globalIndex();
142-
} else {
143-
static_assert(!framework::has_type<A>(typename persistent_table_t::persistent_columns_t{}), "Argument type mismatch");
144-
return arg;
145-
}
141+
return arg.globalIndex();
142+
}
143+
144+
template <typename A>
145+
static decltype(auto) extract(A const& arg)
146+
{
147+
return arg;
146148
}
147149

148150
/// The table builder which actually performs the

Framework/Foundation/include/Framework/Pack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ using filtered_pack = std::decay_t<decltype(filter_pack<Condition>(pack<>{}, pac
208208
template <typename T, typename... Us>
209209
bool consteval has_type(framework::pack<Us...>)
210210
{
211-
return (std::is_same_v<T, Us> || ...);
211+
return (std::same_as<T, Us> || ...);
212212
}
213213

214214
template <typename T, typename P>

0 commit comments

Comments
 (0)