mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Clang errors because 2 phase lookup is stupid between compilers.
This commit is contained in:
parent
c42c1bafe5
commit
7f40c4edb6
|
@ -118,28 +118,7 @@ template <bool global = false, typename Key, typename Value>
|
||||||
void set_field(lua_State* L, Key&& key, Value&& value, int tableindex) {
|
void set_field(lua_State* L, Key&& key, Value&& value, int tableindex) {
|
||||||
field_setter<meta::Unqualified<Key>, global>{}.set(L, std::forward<Key>(key), std::forward<Value>(value), tableindex);
|
field_setter<meta::Unqualified<Key>, global>{}.set(L, std::forward<Key>(key), std::forward<Value>(value), tableindex);
|
||||||
}
|
}
|
||||||
} // stack
|
|
||||||
namespace detail {
|
|
||||||
using special_destruct_func = void(*)(void*);
|
|
||||||
|
|
||||||
template <typename T, typename Real>
|
|
||||||
inline void special_destruct(void* memory) {
|
|
||||||
T** pointerpointer = static_cast<T**>(memory);
|
|
||||||
special_destruct_func* dx = static_cast<special_destruct_func*>(static_cast<void*>(pointerpointer + 1));
|
|
||||||
Real* target = static_cast<Real*>(static_cast<void*>(dx + 1));
|
|
||||||
target->~Real();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline int unique_destruct(lua_State* L) {
|
|
||||||
void* memory = stack::get<userdata_value>(L, 1);
|
|
||||||
T** pointerpointer = static_cast<T**>(memory);
|
|
||||||
special_destruct_func& dx = *static_cast<special_destruct_func*>( static_cast<void*>( pointerpointer + 1 ) );
|
|
||||||
(dx)(memory);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} // detail
|
|
||||||
namespace stack {
|
|
||||||
namespace stack_detail {
|
namespace stack_detail {
|
||||||
const bool default_check_arguments =
|
const bool default_check_arguments =
|
||||||
#ifdef SOL_CHECK_ARGUMENTS
|
#ifdef SOL_CHECK_ARGUMENTS
|
||||||
|
@ -219,6 +198,31 @@ struct getter<void*> {
|
||||||
return lua_touserdata(L, index);
|
return lua_touserdata(L, index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} // stack
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
// This needs to be here, specifically, so that it can use get<userdata_value>
|
||||||
|
using special_destruct_func = void(*)(void*);
|
||||||
|
|
||||||
|
template <typename T, typename Real>
|
||||||
|
inline void special_destruct(void* memory) {
|
||||||
|
T** pointerpointer = static_cast<T**>(memory);
|
||||||
|
special_destruct_func* dx = static_cast<special_destruct_func*>(static_cast<void*>(pointerpointer + 1));
|
||||||
|
Real* target = static_cast<Real*>(static_cast<void*>(dx + 1));
|
||||||
|
target->~Real();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline int unique_destruct(lua_State* L) {
|
||||||
|
void* memory = stack::get<userdata_value>(L, 1);
|
||||||
|
T** pointerpointer = static_cast<T**>(memory);
|
||||||
|
special_destruct_func& dx = *static_cast<special_destruct_func*>( static_cast<void*>( pointerpointer + 1 ) );
|
||||||
|
(dx)(memory);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} // detail
|
||||||
|
|
||||||
|
namespace stack {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct getter<T*> {
|
struct getter<T*> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user