mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
fix up container handling
This commit is contained in:
parent
cb3acaa97b
commit
12f8f046cc
|
@ -35,10 +35,12 @@ include(Common/Core)
|
||||||
set(LUA_VANILLA_5.1_LATEST_VERSION 5.1.5)
|
set(LUA_VANILLA_5.1_LATEST_VERSION 5.1.5)
|
||||||
set(LUA_VANILLA_5.2_LATEST_VERSION 5.2.4)
|
set(LUA_VANILLA_5.2_LATEST_VERSION 5.2.4)
|
||||||
set(LUA_VANILLA_5.3_LATEST_VERSION 5.3.5)
|
set(LUA_VANILLA_5.3_LATEST_VERSION 5.3.5)
|
||||||
set(LUA_VANILLA_5.4_LATEST_VERSION 5.4.0-work1)
|
set(LUA_VANILLA_5.4_LATEST_VERSION 5.4.0-alpha)
|
||||||
|
|
||||||
# exact version, coming from CI: pull directly from Lua and use external project to build
|
# exact version, coming from CI: pull directly from Lua and use external project to build
|
||||||
# list of known md5 / sha1: must update when there are changes
|
# list of known md5 / sha1: must update when there are changes
|
||||||
|
set(LUA_VANILLA_MD5_5.4.0-alpha d49d30b394794b96ffad53513ac647a5)
|
||||||
|
set(LUA_VANILLA_SHA1_5.4.0-alpha cf3559dc43cad35463740c6fbedeb1ea501e5e23)
|
||||||
set(LUA_VANILLA_MD5_5.4.0-work2 3cdf2a4eb84dde6b6aaf5d2d1de07be9)
|
set(LUA_VANILLA_MD5_5.4.0-work2 3cdf2a4eb84dde6b6aaf5d2d1de07be9)
|
||||||
set(LUA_VANILLA_SHA1_5.4.0-work2 e8484e61c5c338e3ec2f75dbe0f6703d079fecf9)
|
set(LUA_VANILLA_SHA1_5.4.0-work2 e8484e61c5c338e3ec2f75dbe0f6703d079fecf9)
|
||||||
set(LUA_VANILLA_MD5_5.4.0-work1 0ff232b8658884155a43cf72212edbd9)
|
set(LUA_VANILLA_MD5_5.4.0-work1 0ff232b8658884155a43cf72212edbd9)
|
||||||
|
@ -212,7 +214,7 @@ if (LUA_BUILD_LUA_COMPILER)
|
||||||
endif()
|
endif()
|
||||||
set(LUA_VANILLA_GENERATE_LUA_HPP false)
|
set(LUA_VANILLA_GENERATE_LUA_HPP false)
|
||||||
elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4")
|
elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4")
|
||||||
if (LUA_VANILLA_VERSION MATCHES "work")
|
if (LUA_VANILLA_VERSION MATCHES "work" OR LUA_VANILLA_VERSION MATCHES "alpha")
|
||||||
set(LUA_VANILLA_DOWNLOAD_URL https://www.lua.org/work/lua-${LUA_VANILLA_VERSION}.tar.gz)
|
set(LUA_VANILLA_DOWNLOAD_URL https://www.lua.org/work/lua-${LUA_VANILLA_VERSION}.tar.gz)
|
||||||
endif()
|
endif()
|
||||||
set(LUA_VANILLA_LIB_SOURCES lapi.c lauxlib.c lbaselib.c lcode.c lcorolib.c
|
set(LUA_VANILLA_LIB_SOURCES lapi.c lauxlib.c lbaselib.c lcode.c lcorolib.c
|
||||||
|
|
|
@ -709,14 +709,30 @@ namespace sol {
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
static detail::error_result set_associative_insert(std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
|
static detail::error_result set_associative_insert(std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
|
||||||
self.insert(it, value_type(key, value.as<V>()));
|
if constexpr(meta::has_insert<T>::value) {
|
||||||
return {};
|
self.insert(it, value_type(key, value.as<V>()));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)self;
|
||||||
|
(void)it;
|
||||||
|
(void)key;
|
||||||
|
return detail::error_result("cannot call 'set' on '%s': there is no 'insert' function on this associative type", detail::demangle<T>().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
static detail::error_result set_associative_insert(std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
|
static detail::error_result set_associative_insert(std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
|
||||||
self.insert(it, key);
|
if constexpr(has_insert<T>::value) {
|
||||||
return {};
|
self.insert(it, key);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)self;
|
||||||
|
(void)it;
|
||||||
|
(void)key;
|
||||||
|
return detail::error_result("cannot call 'set' on '%s': there is no 'insert' function on this non-associative type", detail::demangle<T>().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static detail::error_result set_associative_find(std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
|
static detail::error_result set_associative_find(std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
|
||||||
|
@ -898,8 +914,17 @@ namespace sol {
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
|
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
|
||||||
self.insert(pos, value_type(key.as<K>(), stack::unqualified_get<V>(L, 3)));
|
if constexpr(meta::has_insert<T>::value) {
|
||||||
return {};
|
self.insert(pos, value_type(key.as<K>(), stack::unqualified_get<V>(L, 3)));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)L;
|
||||||
|
(void)self;
|
||||||
|
(void)key;
|
||||||
|
(void)pos;
|
||||||
|
return detail::error_result("cannot call 'insert' on '%s': there is no 'insert' function on this associative type", detail::demangle<T>().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key) {
|
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key) {
|
||||||
|
@ -1067,10 +1092,23 @@ namespace sol {
|
||||||
return deferred_uc::begin(L, self) == deferred_uc::end(L, self);
|
return deferred_uc::begin(L, self) == deferred_uc::end(L, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static detail::error_result get_start(lua_State* L, T& self, K& key) {
|
static detail::error_result get_associative_find(std::true_type, lua_State* L, T& self, K& key) {
|
||||||
|
auto it = self.find(key);
|
||||||
|
if (it == deferred_uc::end(L, self)) {
|
||||||
|
stack::push(L, lua_nil);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return get_associative(std::true_type(), L, it);
|
||||||
|
}
|
||||||
|
|
||||||
|
static detail::error_result get_associative_find(std::false_type, lua_State* L, T& self, K& key) {
|
||||||
return get_it(is_linear_integral(), L, self, key);
|
return get_it(is_linear_integral(), L, self, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static detail::error_result get_start(lua_State* L, T& self, K& key) {
|
||||||
|
return get_associative_find(std::integral_constant<bool, is_associative::value && has_find<T>::value>(), L, self, key);
|
||||||
|
}
|
||||||
|
|
||||||
static detail::error_result set_start(lua_State* L, T& self, stack_object key, stack_object value) {
|
static detail::error_result set_start(lua_State* L, T& self, stack_object key, stack_object value) {
|
||||||
return set_it(is_linear_integral(), L, self, std::move(key), std::move(value));
|
return set_it(is_linear_integral(), L, self, std::move(key), std::move(value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2019-08-15 05:26:10.792424 UTC
|
// Generated 2019-08-15 06:28:23.273623 UTC
|
||||||
// This header was generated with sol v3.0.3 (revision 09f5e86)
|
// This header was generated with sol v3.0.3 (revision cb3acaa)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2019-08-15 05:26:10.095950 UTC
|
// Generated 2019-08-15 06:28:22.668458 UTC
|
||||||
// This header was generated with sol v3.0.3 (revision 09f5e86)
|
// This header was generated with sol v3.0.3 (revision cb3acaa)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
|
@ -19672,14 +19672,30 @@ namespace sol {
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
static detail::error_result set_associative_insert(std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
|
static detail::error_result set_associative_insert(std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
|
||||||
self.insert(it, value_type(key, value.as<V>()));
|
if constexpr(meta::has_insert<T>::value) {
|
||||||
return {};
|
self.insert(it, value_type(key, value.as<V>()));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)self;
|
||||||
|
(void)it;
|
||||||
|
(void)key;
|
||||||
|
return detail::error_result("cannot call 'set' on '%s': there is no 'insert' function on this associative type", detail::demangle<T>().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
static detail::error_result set_associative_insert(std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
|
static detail::error_result set_associative_insert(std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
|
||||||
self.insert(it, key);
|
if constexpr(has_insert<T>::value) {
|
||||||
return {};
|
self.insert(it, key);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)self;
|
||||||
|
(void)it;
|
||||||
|
(void)key;
|
||||||
|
return detail::error_result("cannot call 'set' on '%s': there is no 'insert' function on this non-associative type", detail::demangle<T>().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static detail::error_result set_associative_find(std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
|
static detail::error_result set_associative_find(std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
|
||||||
|
@ -19861,8 +19877,17 @@ namespace sol {
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
|
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
|
||||||
self.insert(pos, value_type(key.as<K>(), stack::unqualified_get<V>(L, 3)));
|
if constexpr(meta::has_insert<T>::value) {
|
||||||
return {};
|
self.insert(pos, value_type(key.as<K>(), stack::unqualified_get<V>(L, 3)));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)L;
|
||||||
|
(void)self;
|
||||||
|
(void)key;
|
||||||
|
(void)pos;
|
||||||
|
return detail::error_result("cannot call 'insert' on '%s': there is no 'insert' function on this associative type", detail::demangle<T>().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key) {
|
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key) {
|
||||||
|
@ -20030,10 +20055,23 @@ namespace sol {
|
||||||
return deferred_uc::begin(L, self) == deferred_uc::end(L, self);
|
return deferred_uc::begin(L, self) == deferred_uc::end(L, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static detail::error_result get_start(lua_State* L, T& self, K& key) {
|
static detail::error_result get_associative_find(std::true_type, lua_State* L, T& self, K& key) {
|
||||||
|
auto it = self.find(key);
|
||||||
|
if (it == deferred_uc::end(L, self)) {
|
||||||
|
stack::push(L, lua_nil);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return get_associative(std::true_type(), L, it);
|
||||||
|
}
|
||||||
|
|
||||||
|
static detail::error_result get_associative_find(std::false_type, lua_State* L, T& self, K& key) {
|
||||||
return get_it(is_linear_integral(), L, self, key);
|
return get_it(is_linear_integral(), L, self, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static detail::error_result get_start(lua_State* L, T& self, K& key) {
|
||||||
|
return get_associative_find(std::integral_constant<bool, is_associative::value && has_find<T>::value>(), L, self, key);
|
||||||
|
}
|
||||||
|
|
||||||
static detail::error_result set_start(lua_State* L, T& self, stack_object key, stack_object value) {
|
static detail::error_result set_start(lua_State* L, T& self, stack_object key, stack_object value) {
|
||||||
return set_it(is_linear_integral(), L, self, std::move(key), std::move(value));
|
return set_it(is_linear_integral(), L, self, std::move(key), std::move(value));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user