Skip to content

Commit

Permalink
Fix CPP_assert for valueGetterGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-tyb committed Feb 11, 2025
1 parent 214825f commit 707f5bf
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/engine/sparqlExpressions/SparqlExpressionGenerators.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,21 @@ CPP_template(typename Input, typename Transformation = std::identity)(

/// Generate `numItems` many values from the `input` and apply the
/// `valueGetter` to each of the values.
inline auto valueGetterGenerator =
[]<typename ValueGetter, typename Input>(
size_t numElements, EvaluationContext* context, Input&& input,
ValueGetter&& valueGetter) {
CPP_assert(SingleExpressionResult<Input>);
auto transformation = [context, valueGetter]<typename I>(I&& i) {
CPP_assert(ranges::invocable<ValueGetter, I&&, EvaluationContext*>);
context->cancellationHandle_->throwIfCancelled();
return valueGetter(AD_FWD(i), context);
};
return makeGenerator(std::forward<Input>(input), numElements, context,
transformation);
};
inline auto valueGetterGenerator = []<typename ValueGetter, typename Input>(
size_t numElements,
EvaluationContext* context,
Input&& input,
ValueGetter&& valueGetter) {
CPP_assert(SingleExpressionResult<Input>);
auto transformation = [context, valueGetter]<typename I>(I&& i)
-> CPP_ret(decltype(valueGetter(AD_FWD(i), context)))(
requires ranges::invocable<ValueGetter, I&&, EvaluationContext*>) {
context->cancellationHandle_->throwIfCancelled();
return valueGetter(AD_FWD(i), context);
};
return makeGenerator(std::forward<Input>(input), numElements, context,
transformation);
};

/// Do the following `numItems` times: Obtain the next elements e_1, ..., e_n
/// from the `generators` and yield `function(e_1, ..., e_n)`, also as a
Expand Down

0 comments on commit 707f5bf

Please sign in to comment.