From 204ef5de4510fae63cb17996f8ba4626839e9503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Neum=C3=BCller?= Date: Thu, 4 Jul 2013 10:00:57 +0200 Subject: [PATCH] Do not store unused cast functions. In luabind::detail::class_base::m_registration::m_bases (where m_registration is a luabind::detail::class_registration). m_bases was a mutable std::vector (base_desc was a typedef on std::pair) and is now simply a std::vector. --- luabind/class.hpp | 4 ++-- src/class.cpp | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/luabind/class.hpp b/luabind/class.hpp index 194eebed..a0d8f064 100644 --- a/luabind/class.hpp +++ b/luabind/class.hpp @@ -267,7 +267,7 @@ namespace luabind type_id const& type, class_id id , type_id const& wrapped_type, class_id wrapper_id); - void add_base(type_id const& base, cast_function cast); + void add_base(type_id const& base); void add_member(registration* member); void add_default_member(registration* member); @@ -530,7 +530,7 @@ namespace luabind template void gen_base_info(detail::type_) { - add_base(typeid(To), detail::static_cast_::execute); + add_base(typeid(To)); add_cast( detail::registered_class::id , detail::registered_class::id diff --git a/src/class.cpp b/src/class.cpp index b334ee60..62f61aad 100755 --- a/src/class.cpp +++ b/src/class.cpp @@ -68,8 +68,7 @@ namespace luabind { namespace detail { mutable std::map m_static_constants; - typedef std::pair base_desc; - mutable std::vector m_bases; + mutable std::vector m_bases; type_id m_type; class_id m_id; @@ -167,13 +166,13 @@ namespace luabind { namespace detail { casts->insert(e.src, e.target, e.cast); } - for (std::vector::iterator i = m_bases.begin(); + for (std::vector::iterator i = m_bases.begin(); i != m_bases.end(); ++i) { LUABIND_CHECK_STACK(L); // the baseclass' class_rep structure - detail::class_rep* bcrep = registry->find_class(i->first); + detail::class_rep* bcrep = registry->find_class(*i); crep->add_base_class(bcrep); @@ -254,9 +253,9 @@ namespace luabind { namespace detail { m_registration->m_wrapper_id = wrapper_id; } - void class_base::add_base(type_id const& base, cast_function cast) + void class_base::add_base(type_id const& base) { - m_registration->m_bases.push_back(std::make_pair(base, cast)); + m_registration->m_bases.push_back(base); } void class_base::add_member(registration* member)