mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
VC++ Compatibility and some changes to function I'll need to test.
This commit is contained in:
parent
ebbceeb9e2
commit
4dab754b86
|
@ -61,6 +61,16 @@ public:
|
|||
function(const function&) = default;
|
||||
function& operator=(const function&) = default;
|
||||
|
||||
template<typename... Args>
|
||||
void operator()( Args&&... args ) {
|
||||
call<>(std::forward<Args>(args)... );
|
||||
}
|
||||
|
||||
template<typename... Ret, typename... Args>
|
||||
auto operator()( types<Ret...>, Args&&... args ) {
|
||||
return call<Ret...>(std::forward<Args>(args)... );
|
||||
}
|
||||
|
||||
template<typename... Ret, typename... Args>
|
||||
auto call(Args&&... args) -> decltype(invoke(types<Ret...>(), sizeof...(Args))) {
|
||||
push();
|
||||
|
|
|
@ -82,13 +82,13 @@ public:
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
auto operator[](T&& key) -> decltype(proxy<decltype(*this), T>(*this, std::forward<T>(key))) {
|
||||
return proxy<decltype(*this), T>(*this, std::forward<T>(key));
|
||||
proxy<table, T> operator[](T&& key) {
|
||||
return proxy<table, T>(*this, std::forward<T>(key));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto operator[](T&& key) const -> decltype(proxy<decltype(*this), T>(*this, std::forward<T>(key))) {
|
||||
return proxy<decltype(*this), T>(*this, std::forward<T>(key));
|
||||
proxy<const table, T> operator[](T&& key) const {
|
||||
return proxy<const table, T>(*this, std::forward<T>(key));
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
|
|
|
@ -120,6 +120,7 @@ TEST_CASE("advanced/callLambdaReturns", "Checks for lambdas returning values") {
|
|||
lua.set_function("g", [ ] { return std::string("str"); });
|
||||
lua.set_function("h", [ ] { });
|
||||
lua.set_function("i", [ ] { return sol::nil; });
|
||||
//lua.set_function("i", [ ] { return std::make_tuple(1, 6.28f, 3.14, std::string("heh")); });
|
||||
}
|
||||
|
||||
TEST_CASE("advanced/callLambda2", "A C++ lambda is exposed to lua and called") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user