VC++ Compatibility and some changes to function I'll need to test.

This commit is contained in:
ThePhD 2013-12-13 17:50:24 -05:00
parent ebbceeb9e2
commit 4dab754b86
3 changed files with 15 additions and 4 deletions

View File

@ -61,6 +61,16 @@ public:
function(const function&) = default; function(const function&) = default;
function& operator=(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> template<typename... Ret, typename... Args>
auto call(Args&&... args) -> decltype(invoke(types<Ret...>(), sizeof...(Args))) { auto call(Args&&... args) -> decltype(invoke(types<Ret...>(), sizeof...(Args))) {
push(); push();

View File

@ -82,13 +82,13 @@ public:
} }
template<typename T> template<typename T>
auto operator[](T&& key) -> decltype(proxy<decltype(*this), T>(*this, std::forward<T>(key))) { proxy<table, T> operator[](T&& key) {
return proxy<decltype(*this), T>(*this, std::forward<T>(key)); return proxy<table, T>(*this, std::forward<T>(key));
} }
template<typename T> template<typename T>
auto operator[](T&& key) const -> decltype(proxy<decltype(*this), T>(*this, std::forward<T>(key))) { proxy<const table, T> operator[](T&& key) const {
return proxy<decltype(*this), T>(*this, std::forward<T>(key)); return proxy<const table, T>(*this, std::forward<T>(key));
} }
size_t size() const { size_t size() const {

View File

@ -120,6 +120,7 @@ TEST_CASE("advanced/callLambdaReturns", "Checks for lambdas returning values") {
lua.set_function("g", [ ] { return std::string("str"); }); lua.set_function("g", [ ] { return std::string("str"); });
lua.set_function("h", [ ] { }); lua.set_function("h", [ ] { });
lua.set_function("i", [ ] { return sol::nil; }); 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") { TEST_CASE("advanced/callLambda2", "A C++ lambda is exposed to lua and called") {