mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Have I mentioned I hate GCC? I hate GCC.
This commit is contained in:
parent
350f430d74
commit
bcf4b9b08f
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -17,3 +17,4 @@ x64/
|
||||||
liblua.a
|
liblua.a
|
||||||
sol/include/
|
sol/include/
|
||||||
.ninja*
|
.ninja*
|
||||||
|
include/
|
||||||
|
|
|
@ -50,7 +50,7 @@ TEST_CASE("simple/get", "Tests if the get function works properly.") {
|
||||||
REQUIRE(a == 9.0);
|
REQUIRE(a == 9.0);
|
||||||
|
|
||||||
lua.script("b = nil");
|
lua.script("b = nil");
|
||||||
REQUIRE_NOTHROW(auto b = lua.get<sol::nil_t>("b"));
|
REQUIRE_NOTHROW(lua.get<sol::nil_t>("b"));
|
||||||
|
|
||||||
lua.script("d = 'hello'");
|
lua.script("d = 'hello'");
|
||||||
auto d = lua.get<std::string>("d");
|
auto d = lua.get<std::string>("d");
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "tuple.hpp"
|
|
||||||
|
|
||||||
#ifndef SOL_FUNCTIONAL_HPP
|
#ifndef SOL_FUNCTIONAL_HPP
|
||||||
#define SOL_FUNCTIONAL_HPP
|
#define SOL_FUNCTIONAL_HPP
|
||||||
|
|
||||||
|
#include "tuple.hpp"
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
|
|
@ -60,11 +60,6 @@ inline T get_arithmetic(lua_State* L, std::true_type, int index = -1) {
|
||||||
return get_unsigned<T>(L, std::is_unsigned<T>{}, index);
|
return get_unsigned<T>(L, std::is_unsigned<T>{}, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline T get_helper(lua_State* L, std::true_type, int index = -1) {
|
|
||||||
return get_nil<T>(L, std::is_same<nil_t, T>(), index);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T get_nil(lua_State* L, std::true_type, int index = -1) {
|
inline T get_nil(lua_State* L, std::true_type, int index = -1) {
|
||||||
if (lua_isnil(L, index) == 0)
|
if (lua_isnil(L, index) == 0)
|
||||||
|
@ -78,6 +73,11 @@ inline T get_nil(lua_State* L, std::false_type, int index = -1) {
|
||||||
return T(L, index);
|
return T(L, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T get_helper(lua_State* L, std::true_type, int index = -1) {
|
||||||
|
return get_nil<T>(L, std::is_same<nil_t, T>(), index);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T get_helper(lua_State* L, std::false_type, int index = -1) {
|
inline T get_helper(lua_State* L, std::false_type, int index = -1) {
|
||||||
// T is a fundamental type
|
// T is a fundamental type
|
||||||
|
@ -222,6 +222,10 @@ template<typename F, typename... Vs>
|
||||||
auto ltr_pop(lua_State*, F&& f, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
auto ltr_pop(lua_State*, F&& f, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||||
return f(std::forward<Vs>(vs)...);
|
return f(std::forward<Vs>(vs)...);
|
||||||
}
|
}
|
||||||
|
template<typename F, typename... Vs>
|
||||||
|
auto ltr_pop(lua_State*, F&& f, types<void>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||||
|
return f(std::forward<Vs>(vs)...);
|
||||||
|
}
|
||||||
template<typename F, typename Head, typename... Vs>
|
template<typename F, typename Head, typename... Vs>
|
||||||
auto ltr_pop(lua_State* L, F&& f, types<Head>, Vs&&... vs) -> decltype(ltr_pop(L, std::forward<F>(f), types<>(), std::forward<Vs>(vs)..., pop<Head>(L))) {
|
auto ltr_pop(lua_State* L, F&& f, types<Head>, Vs&&... vs) -> decltype(ltr_pop(L, std::forward<F>(f), types<>(), std::forward<Vs>(vs)..., pop<Head>(L))) {
|
||||||
return ltr_pop(L, std::forward<F>(f), types<>(), std::forward<Vs>(vs)..., pop<Head>(L));
|
return ltr_pop(L, std::forward<F>(f), types<>(), std::forward<Vs>(vs)..., pop<Head>(L));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user