From 7c7f862cb41da82ccb31c60ff4125d305882676c Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sun, 24 Jan 2016 09:19:36 -0500 Subject: [PATCH] fixed proxy (perhaps I broke it recently?) --- bench_lua_function.hpp | 4 ++-- sol/proxy.hpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bench_lua_function.hpp b/bench_lua_function.hpp index 098b3d61..e8ae4881 100644 --- a/bench_lua_function.hpp +++ b/bench_lua_function.hpp @@ -84,8 +84,8 @@ void bench_lua_function( const std::string& dir, std::string& configurationname nonius::benchmark benchmarks [] = { nonius::benchmark( "fast_function - function_result", sol_fast_function_result_lua_bench( ) ), nonius::benchmark( "fast_function - call<>", sol_fast_direct_lua_bench( ) ), - nonius::benchmark( "safe_function - function_result", sol_function_result_lua_bench( ) ), - nonius::benchmark( "safe_function - call<>", sol_direct_lua_bench( ) ), + nonius::benchmark( "function - function_result", sol_function_result_lua_bench( ) ), + nonius::benchmark( "function - call<>", sol_direct_lua_bench( ) ), nonius::benchmark( "plain C", c_direct_lua_bench( ) ), }; nonius::go( cfg, std::begin( benchmarks ), std::end( benchmarks ), nonius::html_reporter( ) ); diff --git a/sol/proxy.hpp b/sol/proxy.hpp index 5b98f90d..89e4495e 100644 --- a/sol/proxy.hpp +++ b/sol/proxy.hpp @@ -81,10 +81,20 @@ public: return get( ); } + template + decltype(auto) operator[](K&& key) const { + return get()[std::forward(key)]; + } + template decltype(auto) call(Args&&... args) { return get().call(std::forward(args)...); } + + template + decltype(auto) operator()(Args&&... args) { + return call<>(std::forward(args)...); + } }; template