Skip to content

Commit

Permalink
DPL: properly handle getting non-existing bindinds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ktf committed Jul 1, 2024
1 parent 045c239 commit 6c2e285
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Framework/Core/include/Framework/ASoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,11 @@ struct ColumnDataHolder {
arrow::ChunkedArray* second;
};

template<typename T, typename B>
concept HasBinding = requires(T& t) {
{ t.B::mColumnIterator };
};

template <typename IP, typename... C>
struct RowViewCore : public IP, C... {
public:
Expand Down Expand Up @@ -964,7 +969,23 @@ struct RowViewCore : public IP, C... {
template <typename DC, typename... B>
auto bindDynamicColumn(framework::pack<B...>)
{
DC::boundIterators = std::make_tuple(&(B::mColumnIterator)...);
DC::boundIterators = std::make_tuple(getDynamicBinding<B>()...);
}

// 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 <typename B>
requires (HasBinding<table_t, B>)
auto getDynamicBinding() {
return &B::mColumnIterator;
}

template <typename B>
auto getDynamicBinding() {
return nullptr;
}
};

Expand Down

0 comments on commit 6c2e285

Please sign in to comment.