Skip to content

Commit 22f7bf5

Browse files
committed
more trait->concept
1 parent d67e108 commit 22f7bf5

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ struct ColumnTrait {
291291

292292
static consteval auto listSize()
293293
{
294-
if constexpr (std::is_same_v<typename C::type, std::vector<int>>) {
294+
if constexpr (std::same_as<typename C::type, std::vector<int>>) {
295295
return -1;
296-
} else if constexpr (std::is_same_v<int[2], typename C::type>) {
296+
} else if constexpr (std::same_as<int[2], typename C::type>) {
297297
return 2;
298298
} else {
299299
return 1;
@@ -303,7 +303,7 @@ struct ColumnTrait {
303303
template <typename T, typename Key>
304304
static std::shared_ptr<SelfIndexColumnBuilder> makeColumnBuilder(arrow::Table* table, arrow::MemoryPool* pool)
305305
{
306-
if constexpr (!std::is_same_v<T, Key>) {
306+
if constexpr (!std::same_as<T, Key>) {
307307
return std::make_shared<IndexColumnBuilder>(getIndexToKey<T, Key>(table), C::columnLabel(), listSize(), pool);
308308
} else {
309309
return std::make_shared<SelfIndexColumnBuilder>(C::columnLabel(), pool);
@@ -364,14 +364,14 @@ struct IndexBuilder {
364364
return std::static_pointer_cast<reduced_t<Key, T>>(columnBuilders[Is])->template find<T>(idx);
365365
}()...};
366366
}(sq);
367-
if constexpr (std::is_same_v<Kind, Sparse>) {
367+
if constexpr (std::same_as<Kind, Sparse>) {
368368
[&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>) {
369369
([&idx, &columnBuilders]() {
370370
using T = typename framework::pack_element_t<Is, framework::pack<Cs...>>;
371371
return std::static_pointer_cast<reduced_t<Key, T>>(columnBuilders[Is])->template fill<T>(idx); }(), ...);
372372
}(sq);
373373
self.fill<C1>(counter);
374-
} else if constexpr (std::is_same_v<Kind, Exclusive>) {
374+
} else if constexpr (std::same_as<Kind, Exclusive>) {
375375
if (std::none_of(finds.begin(), finds.end(), [](bool const x) { return x == false; })) {
376376
[&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>) {
377377
([&idx, &columnBuilders]() {
@@ -549,7 +549,7 @@ struct Service {
549549

550550
decltype(auto) operator->() const
551551
{
552-
if constexpr (is_base_of_template_v<LoadableServicePlugin, T>) {
552+
if constexpr (base_of_template<LoadableServicePlugin, T>) {
553553
return service->get();
554554
} else {
555555
return service;

Framework/Core/include/Framework/AnalysisManagers.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct GroupedCombinationManager<GroupedCombinationsGenerator<T1, GroupingPolicy
4545
static void setGroupedCombination(GroupedCombinationsGenerator<T1, GroupingPolicy, BP, G, As...>& comb, TG& grouping, std::tuple<T2s...>& associated)
4646
{
4747
static_assert(sizeof...(T2s) > 0, "There must be associated tables in process() for a correct pair");
48-
if constexpr (std::is_same_v<G, TG>) {
48+
if constexpr (std::same_as<G, TG>) {
4949
static_assert((framework::has_type<As>(pack<T2s...>{}) && ...), "You didn't subscribed to all tables requested for mixing");
5050
comb.setTables(grouping, associated);
5151
}
@@ -89,7 +89,7 @@ struct PartitionManager<Partition<T>> {
8989
template <typename T2>
9090
static void doSetPartition(Partition<T>& partition, T2& table)
9191
{
92-
if constexpr (std::is_same_v<T, T2>) {
92+
if constexpr (std::same_as<T, T2>) {
9393
partition.bindTable(table);
9494
}
9595
}
@@ -160,7 +160,7 @@ struct ConditionManager {
160160
template <typename ANY>
161161
static bool appendCondition(std::vector<InputSpec>& inputs, ANY& x)
162162
{
163-
if constexpr (std::is_base_of_v<ConditionGroup, ANY>) {
163+
if constexpr (std::derived_from<ANY, ConditionGroup>) {
164164
homogeneous_apply_refs<true>([&inputs](auto& y) { return ConditionManager<std::decay_t<decltype(y)>>::appendCondition(inputs, y); }, x);
165165
return true;
166166
} else {
@@ -171,7 +171,7 @@ struct ConditionManager {
171171
template <typename ANY>
172172
static bool newDataframe(InputRecord& record, ANY& x)
173173
{
174-
if constexpr (std::is_base_of_v<ConfigurableGroup, ANY>) {
174+
if constexpr (std::derived_from<ANY, ConfigurableGroup>) {
175175
homogeneous_apply_refs<true>([&record](auto&& y) { return ConditionManager<std::decay_t<decltype(y)>>::newDataframe(record, y); }, x);
176176
return true;
177177
} else {
@@ -200,7 +200,7 @@ struct OutputManager {
200200
template <typename ANY>
201201
static bool appendOutput(std::vector<OutputSpec>& outputs, ANY& what, uint32_t v)
202202
{
203-
if constexpr (std::is_base_of_v<ProducesGroup, ANY>) {
203+
if constexpr (std::derived_from<ANY, ProducesGroup>) {
204204
homogeneous_apply_refs<true>([&outputs, v](auto& p) { return OutputManager<std::decay_t<decltype(p)>>::appendOutput(outputs, p, v); }, what);
205205
return true;
206206
}
@@ -210,7 +210,7 @@ struct OutputManager {
210210
template <typename ANY>
211211
static bool prepare(ProcessingContext& context, ANY& what)
212212
{
213-
if constexpr (std::is_base_of_v<ProducesGroup, ANY>) {
213+
if constexpr (std::derived_from<ANY, ProducesGroup>) {
214214
homogeneous_apply_refs<true>([&context](auto& p) { return OutputManager<std::decay_t<decltype(p)>>::prepare(context, p); }, what);
215215
return true;
216216
}
@@ -220,7 +220,7 @@ struct OutputManager {
220220
template <typename ANY>
221221
static bool postRun(EndOfStreamContext& context, ANY& what)
222222
{
223-
if constexpr (std::is_base_of_v<ProducesGroup, ANY>) {
223+
if constexpr (std::derived_from<ANY, ProducesGroup>) {
224224
homogeneous_apply_refs<true>([&context](auto& p) { return OutputManager<std::decay_t<decltype(p)>>::postRun(context, p); }, what);
225225
return true;
226226
}
@@ -230,7 +230,7 @@ struct OutputManager {
230230
template <typename ANY>
231231
static bool finalize(ProcessingContext& context, ANY& what)
232232
{
233-
if constexpr (std::is_base_of_v<ProducesGroup, ANY>) {
233+
if constexpr (std::derived_from<ANY, ProducesGroup>) {
234234
homogeneous_apply_refs<true>([&context](auto& p) { return OutputManager<std::decay_t<decltype(p)>>::finalize(context, p); }, what);
235235
return true;
236236
}
@@ -441,7 +441,7 @@ template <typename T>
441441
struct ServiceManager<Service<T>> {
442442
static bool add(std::vector<ServiceSpec>& specs, Service<T>& /*service*/)
443443
{
444-
if constexpr (o2::framework::is_base_of_template_v<LoadableServicePlugin, T>) {
444+
if constexpr (o2::framework::base_of_template<LoadableServicePlugin, T>) {
445445
T p = T{};
446446
auto loadableServices = PluginManager::parsePluginSpecString(p.loadSpec.c_str());
447447
PluginManager::loadFromPlugin<ServiceSpec, ServicePlugin>(loadableServices, specs);
@@ -509,7 +509,7 @@ struct OptionManager {
509509
static bool appendOption(std::vector<ConfigParamSpec>& options, ANY& x)
510510
{
511511
/// Recurse, in case we are brace constructible
512-
if constexpr (std::is_base_of_v<ConfigurableGroup, ANY>) {
512+
if constexpr (std::derived_from<ANY, ConfigurableGroup>) {
513513
if constexpr (requires { x.prefix; }) {
514514
homogeneous_apply_refs<true>([prefix = x.prefix]<typename C>(C& y) { // apend group prefix if set
515515
if constexpr (requires { y.name; }) {
@@ -530,7 +530,7 @@ struct OptionManager {
530530
template <typename ANY>
531531
static bool prepare(InitContext& ic, ANY& x)
532532
{
533-
if constexpr (std::is_base_of_v<ConfigurableGroup, ANY>) {
533+
if constexpr (std::derived_from<ANY, ConfigurableGroup>) {
534534
homogeneous_apply_refs<true>([&ic](auto&& y) { return OptionManager<std::decay_t<decltype(y)>>::prepare(ic, y); }, x);
535535
return true;
536536
} else {

0 commit comments

Comments
 (0)