Skip to content

Commit

Permalink
decltype is_null type, bool or my_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacyking committed Aug 23, 2023
1 parent 1ccb6bd commit 1c3e791
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/mysql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ class mysql {
return v;
}

template <typename T>
template <typename T, typename B>
void set_param_bind(MYSQL_BIND &param_bind, T &&value, int i,
std::map<size_t, std::vector<char>> &mp, bool &is_null) {
std::map<size_t, std::vector<char>> &mp, B &&is_null) {
using U = std::remove_const_t<std::remove_reference_t<T>>;
if constexpr (is_optional_v<U>::value) {
return set_param_bind(param_bind, *value, i, mp, is_null);
Expand Down Expand Up @@ -377,7 +377,7 @@ class mysql {
param_bind.buffer = &(mp.rbegin()->second[0]);
param_bind.buffer_length = 65536;
}
param_bind.is_null = &is_null;
param_bind.is_null = is_null;
}

template <typename T>
Expand Down Expand Up @@ -435,9 +435,9 @@ class mysql {
return {};
}

std::array<decltype(std::declval<MYSQL_BIND>().is_null), SIZE> nulls = {};
std::array<MYSQL_BIND, SIZE> param_binds = {};
std::map<size_t, std::vector<char>> mp;
std::array<bool, SIZE> nulls = {};

std::vector<T> v;
T t{};
Expand Down

0 comments on commit 1c3e791

Please sign in to comment.