Skip to content

Commit

Permalink
Implemented suggestions made during the review
Browse files Browse the repository at this point in the history
  • Loading branch information
trueqbit committed Jun 21, 2024
1 parent 68ba295 commit 43d3103
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions dev/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ namespace sqlite_orm {
*/
template<typename UDF, typename... CallArgs>
#ifdef SQLITE_ORM_RELAXED_CONSTEXPR_SUPPORTED
SQLITE_ORM_CONSTEVAL
SQLITE_ORM_CONSTEVAL void check_function_call() {
#else
void check_function_call() {
#endif
void
check_function_call() {
using call_args_tuple = std::tuple<CallArgs...>;
using function_params_tuple = typename callable_arguments<UDF>::args_tuple;
constexpr size_t callArgsCount = std::tuple_size<call_args_tuple>::value;
Expand Down
6 changes: 3 additions & 3 deletions include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -12949,10 +12949,10 @@ namespace sqlite_orm {
*/
template<typename UDF, typename... CallArgs>
#ifdef SQLITE_ORM_RELAXED_CONSTEXPR_SUPPORTED
SQLITE_ORM_CONSTEVAL
SQLITE_ORM_CONSTEVAL void check_function_call() {
#else
void check_function_call() {
#endif
void
check_function_call() {
using call_args_tuple = std::tuple<CallArgs...>;
using function_params_tuple = typename callable_arguments<UDF>::args_tuple;
constexpr size_t callArgsCount = std::tuple_size<call_args_tuple>::value;
Expand Down
12 changes: 6 additions & 6 deletions tests/user_defined_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ struct MeanFunction {
double total = 0;
int count = 0;

static int wasInstantiatedCount;
static int ctorCallsCount;
static int objectsCount;

MeanFunction() {
++wasInstantiatedCount;
++ctorCallsCount;
++objectsCount;
}

Expand All @@ -108,7 +108,7 @@ struct MeanFunction {
}
};

int MeanFunction::wasInstantiatedCount = 0;
int MeanFunction::ctorCallsCount = 0;
int MeanFunction::objectsCount = 0;

struct FirstFunction {
Expand Down Expand Up @@ -415,12 +415,12 @@ TEST_CASE("custom functions") {
// expect two different aggregate function objects to be created, which provide two different results;
// This ensures that `proxy_get_aggregate_step_udf()` uses `sqlite3_aggregate_context()` correctly
{
MeanFunction::wasInstantiatedCount = 0;
MeanFunction::ctorCallsCount = 0;
REQUIRE(MeanFunction::objectsCount == 0);
REQUIRE(MeanFunction::wasInstantiatedCount == 0);
REQUIRE(MeanFunction::ctorCallsCount == 0);
auto rows = storage.select(columns(func<MeanFunction>(&User::id), func<MeanFunction>(c(&User::id) * 2)));
REQUIRE(MeanFunction::objectsCount == 0);
REQUIRE(MeanFunction::wasInstantiatedCount == 2);
REQUIRE(MeanFunction::ctorCallsCount == 2);
REQUIRE(int(std::get<0>(rows[0])) == 2);
REQUIRE(int(std::get<1>(rows[0])) == 4);
}
Expand Down

0 comments on commit 43d3103

Please sign in to comment.