Skip to content

Commit beb3312

Browse files
author
nitrocaster
committed
Add policies to luabind::functor template parameters.
1 parent c4e5dd2 commit beb3312

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/xrScriptEngine/Functor.hpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,28 @@
66

77
namespace luabind
88
{
9-
template<typename TResult>
9+
template <typename TResult, typename... Policies>
1010
class functor : public adl::object
1111
{
1212
public:
1313
functor() {}
1414
functor(const adl::object &obj) : adl::object(obj) {}
1515

16-
template<typename... Args>
16+
template <typename... Args>
1717
TResult operator()(Args &&...args) const
18-
{ return call_function<TResult>(*static_cast<const adl::object *>(this), std::forward<Args>(args)...); }
18+
{
19+
auto self = static_cast<const adl::object *>(this);
20+
return call_function<TResult, policy_list<Policies...>>(*self, std::forward<Args>(args)...);
21+
}
1922
};
2023

21-
template<>
22-
template<typename... Args>
23-
void functor<void>::operator()(Args &&...args) const
24-
{ call_function<void>(*static_cast<const adl::object *>(this), std::forward<Args>(args)...); }
24+
template <>
25+
template <typename... Args>
26+
void functor<void, typename...>::operator()(Args &&...args) const
27+
{
28+
auto self = static_cast<const adl::object *>(this);
29+
call_function<void, policy_list<Policies...>>(*self, std::forward<Args>(args)...);
30+
}
2531

2632
namespace detail
2733
{

src/xrScriptEngine/script_space_forward.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace adl
1515
class object;
1616
}
1717

18-
template<class T> class functor;
18+
template <typename TResult, typename... Policies>
19+
class functor;
1920
template<class T, class ValueWrapper>
2021
T object_cast(ValueWrapper const& value_wrapper);
2122
};

0 commit comments

Comments
 (0)