Skip to content
Permalink
Browse files
fix lua->C++ pass of const references to arithmetic types (make a copy)
  • Loading branch information
pisto committed Mar 30, 2014
1 parent b8f1b0c commit 0865f1c0aaa25d6d9fd2dfa38e20920c7ae0387a
Showing with 4 additions and 2 deletions.
  1. +1 −0 include/LuaBridge/LuaBridge.h
  2. +3 −2 include/LuaBridge/detail/TypeList.h
@@ -41,6 +41,7 @@

#include <lua.hpp>
#include <new>
#include <type_traits>

#define LUABRIDGE_MAJOR_VERSION 2
#define LUABRIDGE_MINOR_VERSION 0
@@ -123,10 +123,11 @@ struct TypeListValues <TypeList <Head&, Tail> >
template <typename Head, typename Tail>
struct TypeListValues <TypeList <Head const&, Tail> >
{
const Head& hd;
using HeadStorage = typename std::conditional<std::is_arithmetic<Head>::value, Head, Head const&>::type;
HeadStorage hd;
TypeListValues <Tail> tl;

TypeListValues (Head const& hd_, const TypeListValues <Tail>& tl_)
TypeListValues (HeadStorage hd_, const TypeListValues <Tail>& tl_)
: hd (hd_), tl (tl_)
{
}

0 comments on commit 0865f1c

Please sign in to comment.