Skip to content

Commit

Permalink
chore(lib): fix compilation errors in C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
hchunhui committed Oct 4, 2023
1 parent 5671021 commit aa517eb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/lib/lua_templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,32 @@ struct MemberWrapper<R (C::*)(T...) const, f> {
}
};

#if __cplusplus >= 201703L
template<typename R, typename C, typename... T, R (C::*f)(T...) noexcept>
struct MemberWrapper<R (C::*)(T...) noexcept, f> {
template<typename D>
static R wrapT(D &c, T... t) {
return (c.*f)(t...);
}

static R wrap(C &c, T... t) {
return wrapT<C>(c, t...);
}
};

template<typename R, typename C, typename... T, R (C::*f)(T...) const noexcept>
struct MemberWrapper<R (C::*)(T...) const noexcept, f> {
template<typename D>
static R wrapT(const D &c, T... t) {
return (c.*f)(t...);
}

static R wrap(const C &c, T... t) {
return wrapT<C>(c, t...);
}
};
#endif

template<typename F, F f>
struct LUAWRAPPER_LOCAL MemberWrapperV;

Expand Down

0 comments on commit aa517eb

Please sign in to comment.