From 6c2e2858f8c051b850c5f4747516ae60f7980014 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Mon, 1 Jul 2024 09:17:22 +0200 Subject: [PATCH] DPL: properly handle getting non-existing bindinds The current code only works because the template specialization happens late enough. This might or might not be the case, depending for example if one decides to force a given table's code out-of-line. --- Framework/Core/include/Framework/ASoA.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Framework/Core/include/Framework/ASoA.h b/Framework/Core/include/Framework/ASoA.h index 4273c79a57eed..fc5c9cac4a2e5 100644 --- a/Framework/Core/include/Framework/ASoA.h +++ b/Framework/Core/include/Framework/ASoA.h @@ -781,6 +781,11 @@ struct ColumnDataHolder { arrow::ChunkedArray* second; }; +template +concept HasBinding = requires(T& t) { + { t.B::mColumnIterator }; +}; + template struct RowViewCore : public IP, C... { public: @@ -964,7 +969,23 @@ struct RowViewCore : public IP, C... { template auto bindDynamicColumn(framework::pack) { - DC::boundIterators = std::make_tuple(&(B::mColumnIterator)...); + DC::boundIterators = std::make_tuple(getDynamicBinding()...); + } + + // Sometimes dynamic columns are defined for tables in + // the hope that it will be joined / extended with another one which provides + // the full set of bindings. This is to avoid a compilation + // error if constructor for the table or any other thing involving a missing + // binding is preinstanciated. + template + requires (HasBinding) + auto getDynamicBinding() { + return &B::mColumnIterator; + } + + template + auto getDynamicBinding() { + return nullptr; } };