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:
ThePhD 2014-04-24 08:15:12 -04:00 committed by Rapptz
parent faa14f3d35
commit b1504ad1b3
4 changed files with 12 additions and 11 deletions

View File

@ -25,6 +25,7 @@
#include "reference.hpp"
#include "tuple.hpp"
#include "stack.hpp"
#include <cstdint>
namespace sol {
class function : public reference {

View File

@ -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

View File

@ -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')... });

View File

@ -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);
}