mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Missing inline on several functions; causes compilations when sol
is included in multiple Translation Units.
`function.hpp` needed cstdint to be defined to use unit32_t properly.
This commit is contained in:
parent
faa14f3d35
commit
b1504ad1b3
|
@ -25,6 +25,7 @@
|
|||
#include "reference.hpp"
|
||||
#include "tuple.hpp"
|
||||
#include "stack.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace sol {
|
||||
class function : public reference {
|
||||
|
|
|
@ -47,19 +47,19 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
bool operator==(const object& lhs, const nil_t&) {
|
||||
inline bool operator==(const object& lhs, const nil_t&) {
|
||||
return lhs.is<nil_t>();
|
||||
}
|
||||
|
||||
bool operator==(const nil_t&, const object& rhs) {
|
||||
inline bool operator==(const nil_t&, const object& rhs) {
|
||||
return rhs.is<nil_t>();
|
||||
}
|
||||
|
||||
bool operator!=(const object& lhs, const nil_t&) {
|
||||
inline bool operator!=(const object& lhs, const nil_t&) {
|
||||
return !lhs.is<nil_t>();
|
||||
}
|
||||
|
||||
bool operator!=(const nil_t&, const object& rhs) {
|
||||
inline bool operator!=(const nil_t&, const object& rhs) {
|
||||
return !rhs.is<nil_t>();
|
||||
}
|
||||
} // sol
|
||||
|
|
|
@ -214,20 +214,20 @@ inline void push_tuple(lua_State* L, indices<I...>, T&& tuplen) {
|
|||
}
|
||||
|
||||
template<typename F, typename... Vs, typename... Args>
|
||||
auto ltr_pop(lua_State*, F&& f, types<Args...>, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||
inline auto ltr_pop(lua_State*, F&& f, types<Args...>, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||
return f(std::forward<Vs>(vs)...);
|
||||
}
|
||||
template<typename F, typename Head, typename... Tail, typename... Vs, typename... Args>
|
||||
auto ltr_pop(lua_State* L, F&& f, types<Args...> t, types<Head, Tail...>, Vs&&... vs) -> decltype(f(std::declval<Args>()...)) {
|
||||
inline auto ltr_pop(lua_State* L, F&& f, types<Args...> t, types<Head, Tail...>, Vs&&... vs) -> decltype(f(std::declval<Args>()...)) {
|
||||
return ltr_pop(L, std::forward<F>(f), t, types<Tail...>(), std::forward<Vs>(vs)..., pop<Head>(L));
|
||||
}
|
||||
|
||||
template<typename F, typename... Vs, typename... Args>
|
||||
auto rtl_pop(lua_State*, F&& f, types<Args...>, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||
inline auto rtl_pop(lua_State*, F&& f, types<Args...>, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||
return f(std::forward<Vs>(vs)...);
|
||||
}
|
||||
template<typename F, typename Head, typename... Tail, typename... Vs, typename... Args>
|
||||
auto rtl_pop(lua_State* L, F&& f, types<Args...> t, types<Head, Tail...>, Vs&&... vs) -> decltype(f(std::declval<Args>()...)) {
|
||||
inline auto rtl_pop(lua_State* L, F&& f, types<Args...> t, types<Head, Tail...>, Vs&&... vs) -> decltype(f(std::declval<Args>()...)) {
|
||||
return rtl_pop(L, std::forward<F>(f), t, types<Tail...>(), pop<Head>(L), std::forward<Vs>(vs)...);
|
||||
}
|
||||
} // detail
|
||||
|
@ -267,12 +267,12 @@ inline auto pop_reverse_call(lua_State* L, TFx&& fx, types<Args...> t) -> declty
|
|||
return detail::rtl_pop(L, std::forward<TFx>(fx), t, reversed<Args...>());
|
||||
}
|
||||
|
||||
void push_args(lua_State*) {
|
||||
inline void push_args(lua_State*) {
|
||||
|
||||
}
|
||||
|
||||
template<typename Arg, typename... Args>
|
||||
void push_args(lua_State* L, Arg&& arg, Args&&... args) {
|
||||
inline void push_args(lua_State* L, Arg&& arg, Args&&... args) {
|
||||
using swallow = char[];
|
||||
stack::push(L, std::forward<Arg>(arg));
|
||||
void(swallow{'\0', (stack::push(L, std::forward<Args>(args)), '\0')... });
|
||||
|
|
|
@ -34,7 +34,7 @@ struct are_same : std::true_type {};
|
|||
template<class T, class U, class... Args>
|
||||
struct are_same<T, U, Args...> : std::integral_constant<bool, std::is_same<T, U>::value && are_same<T, Args...>::value> {};
|
||||
|
||||
int atpanic(lua_State* L) {
|
||||
inline int atpanic(lua_State* L) {
|
||||
std::string err = lua_tostring(L, -1);
|
||||
throw sol_error(err);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user