mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 21:13:26 +02:00
Rename stdext::shared_object_ptr to compile in gcc 4.6
This commit is contained in:
@@ -30,6 +30,6 @@ class LuaObject;
|
||||
|
||||
typedef std::function<int(LuaInterface*)> LuaCppFunction;
|
||||
typedef std::unique_ptr<LuaCppFunction> LuaCppFunctionPtr;
|
||||
typedef stdext::shared_object_ptr<LuaObject> LuaObjectPtr;
|
||||
typedef boost::intrusive_ptr<LuaObject> LuaObjectPtr;
|
||||
|
||||
#endif
|
||||
|
@@ -152,18 +152,18 @@ namespace luabinder
|
||||
|
||||
/// Create member function lambdas
|
||||
template<typename Ret, typename C, typename... Args>
|
||||
std::function<Ret(const stdext::shared_object_ptr<C>&, const Args&...)> make_mem_func(Ret (C::* f)(Args...)) {
|
||||
std::function<Ret(const boost::intrusive_ptr<C>&, const Args&...)> make_mem_func(Ret (C::* f)(Args...)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](const stdext::shared_object_ptr<C>& obj, const Args&... args) mutable -> Ret {
|
||||
return [=](const boost::intrusive_ptr<C>& obj, const Args&... args) mutable -> Ret {
|
||||
if(!obj)
|
||||
throw LuaException("failed to call a member function because the passed object is nil");
|
||||
return mf(obj.get(), args...);
|
||||
};
|
||||
}
|
||||
template<typename C, typename... Args>
|
||||
std::function<void(const stdext::shared_object_ptr<C>&, const Args&...)> make_mem_func(void (C::* f)(Args...)) {
|
||||
std::function<void(const boost::intrusive_ptr<C>&, const Args&...)> make_mem_func(void (C::* f)(Args...)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](const stdext::shared_object_ptr<C>& obj, const Args&... args) mutable -> void {
|
||||
return [=](const boost::intrusive_ptr<C>& obj, const Args&... args) mutable -> void {
|
||||
if(!obj)
|
||||
throw LuaException("failed to call a member function because the passed object is nil");
|
||||
mf(obj.get(), args...);
|
||||
@@ -186,7 +186,7 @@ namespace luabinder
|
||||
/// Bind member functions
|
||||
template<typename C, typename Ret, class FC, typename... Args>
|
||||
LuaCppFunction bind_mem_fun(Ret (FC::* f)(Args...)) {
|
||||
typedef typename std::tuple<stdext::shared_object_ptr<FC>, typename remove_const_ref<Args>::type...> Tuple;
|
||||
typedef typename std::tuple<boost::intrusive_ptr<FC>, typename remove_const_ref<Args>::type...> Tuple;
|
||||
auto lambda = make_mem_func<Ret,FC>(f);
|
||||
return bind_fun_specializer<typename remove_const_ref<Ret>::type,
|
||||
decltype(lambda),
|
||||
@@ -209,7 +209,7 @@ namespace luabinder
|
||||
LuaCppFunction bind_mem_fun(int (C::*f)(LuaInterface*)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](LuaInterface* lua) -> int {
|
||||
auto obj = lua->castValue<stdext::shared_object_ptr<C>>(1);
|
||||
auto obj = lua->castValue<boost::intrusive_ptr<C>>(1);
|
||||
lua->remove(1);
|
||||
return mf(obj, lua);
|
||||
};
|
||||
|
@@ -111,7 +111,7 @@ bool luavalue_cast(int index, LuaObjectPtr& obj);
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_base_of<LuaObject, T>::value, bool>::type
|
||||
luavalue_cast(int index, stdext::shared_object_ptr<T>& ptr);
|
||||
luavalue_cast(int index, boost::intrusive_ptr<T>& ptr);
|
||||
|
||||
// std::function
|
||||
template<typename Ret, typename... Args>
|
||||
@@ -186,7 +186,7 @@ push_luavalue(const T& obj) {
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_base_of<LuaObject, T>::value, bool>::type
|
||||
luavalue_cast(int index, stdext::shared_object_ptr<T>& ptr) {
|
||||
luavalue_cast(int index, boost::intrusive_ptr<T>& ptr) {
|
||||
LuaObjectPtr obj;
|
||||
if(!luavalue_cast(index, obj))
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user