mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
more minor fixes for bad trait usage, wee
This commit is contained in:
parent
c3c08df787
commit
e03f53d4dc
|
@ -64,7 +64,8 @@ namespace sol {
|
|||
struct has_erase_after_test {
|
||||
private:
|
||||
template <typename C>
|
||||
static meta::sfinae_yes_t test(decltype(std::declval<C>().erase_after(std::declval<std::add_rvalue_reference_t<typename C::const_iterator>>()))*);
|
||||
static meta::sfinae_yes_t test(
|
||||
decltype(std::declval<C>().erase_after(std::declval<std::add_rvalue_reference_t<typename C::const_iterator>>()))*);
|
||||
template <typename C>
|
||||
static meta::sfinae_no_t test(...);
|
||||
|
||||
|
@ -404,7 +405,8 @@ namespace sol {
|
|||
}
|
||||
|
||||
static int index_set(lua_State* L) {
|
||||
return luaL_error(L, "sol: cannot call 'container[key] = value' on type '%s': it is not recognized as a container", detail::demangle<T>().c_str());
|
||||
return luaL_error(
|
||||
L, "sol: cannot call 'container[key] = value' on type '%s': it is not recognized as a container", detail::demangle<T>().c_str());
|
||||
}
|
||||
|
||||
static int add(lua_State* L) {
|
||||
|
@ -463,7 +465,9 @@ namespace sol {
|
|||
};
|
||||
|
||||
template <typename X>
|
||||
struct usertype_container_default<X, std::enable_if_t<meta::all<is_forced_container<meta::unqualified_t<X>>, meta::has_value_type<meta::unqualified_t<container_decay_t<X>>>, meta::has_iterator<meta::unqualified_t<container_decay_t<X>>>>::value>> {
|
||||
struct usertype_container_default<X,
|
||||
std::enable_if_t<meta::all<is_forced_container<meta::unqualified_t<X>>, meta::has_value_type<meta::unqualified_t<container_decay_t<X>>>,
|
||||
meta::has_iterator<meta::unqualified_t<container_decay_t<X>>>>::value>> {
|
||||
private:
|
||||
using T = std::remove_pointer_t<meta::unwrap_unqualified_t<container_decay_t<X>>>;
|
||||
|
||||
|
@ -475,32 +479,21 @@ namespace sol {
|
|||
using is_matched_lookup = meta::is_matched_lookup<T>;
|
||||
using iterator = typename T::iterator;
|
||||
using value_type = typename T::value_type;
|
||||
typedef meta::conditional_t<is_matched_lookup::value,
|
||||
std::pair<value_type, value_type>,
|
||||
meta::conditional_t<is_associative::value || is_lookup::value,
|
||||
value_type,
|
||||
std::pair<std::ptrdiff_t, value_type>>>
|
||||
typedef meta::conditional_t<is_matched_lookup::value, std::pair<value_type, value_type>,
|
||||
meta::conditional_t<is_associative::value || is_lookup::value, value_type, std::pair<std::ptrdiff_t, value_type>>>
|
||||
KV;
|
||||
typedef typename KV::first_type K;
|
||||
typedef typename KV::second_type V;
|
||||
typedef meta::conditional_t<is_matched_lookup::value, std::ptrdiff_t, K> next_K;
|
||||
typedef decltype(*std::declval<iterator&>()) iterator_return;
|
||||
typedef meta::conditional_t<is_associative::value || is_matched_lookup::value,
|
||||
std::add_lvalue_reference_t<V>,
|
||||
meta::conditional_t<is_lookup::value,
|
||||
V,
|
||||
iterator_return>>
|
||||
typedef meta::conditional_t<is_associative::value || is_matched_lookup::value, std::add_lvalue_reference_t<V>,
|
||||
meta::conditional_t<is_lookup::value, V, iterator_return>>
|
||||
captured_type;
|
||||
typedef typename meta::iterator_tag<iterator>::type iterator_category;
|
||||
typedef std::is_same<iterator_category, std::input_iterator_tag> is_input_iterator;
|
||||
typedef meta::conditional_t<is_input_iterator::value,
|
||||
V,
|
||||
decltype(detail::deref_non_pointer(std::declval<captured_type>()))>
|
||||
push_type;
|
||||
typedef meta::conditional_t<is_input_iterator::value, V, decltype(detail::deref_non_pointer(std::declval<captured_type>()))> push_type;
|
||||
typedef std::is_copy_assignable<V> is_copyable;
|
||||
typedef meta::neg<meta::any<
|
||||
std::is_const<V>, std::is_const<std::remove_reference_t<iterator_return>>, meta::neg<is_copyable>>>
|
||||
is_writable;
|
||||
typedef meta::neg<meta::any<std::is_const<V>, std::is_const<std::remove_reference_t<iterator_return>>, meta::neg<is_copyable>>> is_writable;
|
||||
typedef meta::unqualified_t<decltype(get_key(is_associative(), std::declval<std::add_lvalue_reference_t<value_type>>()))> key_type;
|
||||
typedef meta::all<std::is_integral<K>, meta::neg<meta::any<is_associative, is_lookup>>> is_linear_integral;
|
||||
|
||||
|
@ -509,12 +502,10 @@ namespace sol {
|
|||
iterator it;
|
||||
std::size_t i;
|
||||
|
||||
iter(T& source, iterator it)
|
||||
: source(source), it(std::move(it)), i(0) {
|
||||
iter(T& source, iterator it) : source(source), it(std::move(it)), i(0) {
|
||||
}
|
||||
|
||||
~iter() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -522,10 +513,13 @@ namespace sol {
|
|||
#if defined(SOL_SAFE_USERTYPE) && SOL_SAFE_USERTYPE
|
||||
auto p = stack::unqualified_check_get<T*>(L, 1);
|
||||
if (!p) {
|
||||
luaL_error(L, "sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)", detail::demangle<T>().c_str());
|
||||
luaL_error(L,
|
||||
"sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)",
|
||||
detail::demangle<T>().c_str());
|
||||
}
|
||||
if (p.value() == nullptr) {
|
||||
luaL_error(L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
luaL_error(
|
||||
L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
}
|
||||
return *p.value();
|
||||
#else
|
||||
|
@ -613,9 +607,7 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result get_comparative(std::true_type, lua_State* L, T& self, K& key) {
|
||||
auto fx = [&](const value_type& r) -> bool {
|
||||
return key == get_key(is_associative(), r);
|
||||
};
|
||||
auto fx = [&](const value_type& r) -> bool { return key == get_key(is_associative(), r); };
|
||||
auto e = deferred_uc::end(L, self);
|
||||
auto it = std::find_if(deferred_uc::begin(L, self), e, std::ref(fx));
|
||||
if (it == e) {
|
||||
|
@ -625,7 +617,9 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result get_comparative(std::false_type, lua_State*, T&, K&) {
|
||||
return detail::error_result("cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'", detail::demangle<T>().data(), detail::demangle<K>().data());
|
||||
return detail::error_result("cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'",
|
||||
detail::demangle<T>().data(),
|
||||
detail::demangle<K>().data());
|
||||
}
|
||||
|
||||
static detail::error_result get_it(std::false_type, lua_State* L, T& self, K& key) {
|
||||
|
@ -649,7 +643,8 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result set_writable(std::false_type, lua_State*, T&, iterator&, stack_object) {
|
||||
return detail::error_result("cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
return detail::error_result(
|
||||
"cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
}
|
||||
|
||||
static detail::error_result set_category(std::input_iterator_tag, lua_State* L, T& self, stack_object okey, stack_object value) {
|
||||
|
@ -690,11 +685,10 @@ namespace sol {
|
|||
static detail::error_result set_comparative(std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
|
||||
decltype(auto) key = okey.as<K>();
|
||||
if (!is_writable::value) {
|
||||
return detail::error_result("cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
return detail::error_result(
|
||||
"cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
}
|
||||
auto fx = [&](const value_type& r) -> bool {
|
||||
return key == get_key(is_associative(), r);
|
||||
};
|
||||
auto fx = [&](const value_type& r) -> bool { return key == get_key(is_associative(), r); };
|
||||
auto e = deferred_uc::end(L, self);
|
||||
auto it = std::find_if(deferred_uc::begin(L, self), e, std::ref(fx));
|
||||
if (it == e) {
|
||||
|
@ -704,12 +698,14 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result set_comparative(std::false_type, lua_State*, T&, stack_object, stack_object) {
|
||||
return detail::error_result("cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key", detail::demangle<T>().data(), detail::demangle<K>().data());
|
||||
return detail::error_result("cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key",
|
||||
detail::demangle<T>().data(),
|
||||
detail::demangle<K>().data());
|
||||
}
|
||||
|
||||
template <typename Iter>
|
||||
static detail::error_result set_associative_insert(std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
|
||||
if constexpr(meta::has_insert<T>::value) {
|
||||
if constexpr (meta::has_insert<T>::value) {
|
||||
self.insert(it, value_type(key, value.as<V>()));
|
||||
return {};
|
||||
}
|
||||
|
@ -717,13 +713,14 @@ namespace sol {
|
|||
(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());
|
||||
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>
|
||||
static detail::error_result set_associative_insert(std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
|
||||
if constexpr(has_insert<T>::value) {
|
||||
if constexpr (meta::has_insert<T>::value) {
|
||||
self.insert(it, key);
|
||||
return {};
|
||||
}
|
||||
|
@ -731,7 +728,8 @@ namespace sol {
|
|||
(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());
|
||||
return detail::error_result(
|
||||
"cannot call 'set' on '%s': there is no 'insert' function on this non-associative type", detail::demangle<T>().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -822,7 +820,8 @@ namespace sol {
|
|||
|
||||
template <bool = false>
|
||||
static detail::error_result find_comparative(std::false_type, lua_State*, T&) {
|
||||
return detail::error_result("cannot call 'find' on '%s': there is no 'find' function and the value_type is not equality comparable", detail::demangle<T>().c_str());
|
||||
return detail::error_result("cannot call 'find' on '%s': there is no 'find' function and the value_type is not equality comparable",
|
||||
detail::demangle<T>().c_str());
|
||||
}
|
||||
|
||||
template <bool idx_of = false>
|
||||
|
@ -914,7 +913,7 @@ namespace sol {
|
|||
|
||||
template <typename Iter>
|
||||
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
|
||||
if constexpr(meta::has_insert<T>::value) {
|
||||
if constexpr (meta::has_insert<T>::value) {
|
||||
self.insert(pos, value_type(key.as<K>(), stack::unqualified_get<V>(L, 3)));
|
||||
return {};
|
||||
}
|
||||
|
@ -923,7 +922,8 @@ namespace sol {
|
|||
(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());
|
||||
return detail::error_result(
|
||||
"cannot call 'insert' on '%s': there is no 'insert' function on this associative type", detail::demangle<T>().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -990,7 +990,8 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result insert_after_has(std::false_type, lua_State*, T&, stack_object, stack_object) {
|
||||
return detail::error_result("cannot call 'insert' on '%s': no suitable or similar functionality detected on this container", detail::demangle<T>().data());
|
||||
return detail::error_result(
|
||||
"cannot call 'insert' on '%s': no suitable or similar functionality detected on this container", detail::demangle<T>().data());
|
||||
}
|
||||
|
||||
static detail::error_result insert_has(std::true_type, lua_State* L, T& self, stack_object key, stack_object value) {
|
||||
|
@ -1019,9 +1020,7 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result erase_integral(std::false_type, lua_State* L, T& self, const K& key) {
|
||||
auto fx = [&](const value_type& r) -> bool {
|
||||
return key == r;
|
||||
};
|
||||
auto fx = [&](const value_type& r) -> bool { return key == r; };
|
||||
auto e = deferred_uc::end(L, self);
|
||||
auto it = std::find_if(deferred_uc::begin(L, self), e, std::ref(fx));
|
||||
if (it == e) {
|
||||
|
@ -1106,7 +1105,7 @@ namespace sol {
|
|||
}
|
||||
|
||||
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);
|
||||
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) {
|
||||
|
@ -1333,8 +1332,7 @@ namespace sol {
|
|||
T& source;
|
||||
iterator it;
|
||||
|
||||
iter(T& source, iterator it)
|
||||
: source(source), it(std::move(it)) {
|
||||
iter(T& source, iterator it) : source(source), it(std::move(it)) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1342,10 +1340,13 @@ namespace sol {
|
|||
auto p = stack::unqualified_check_get<T*>(L, 1);
|
||||
#if defined(SOL_SAFE_USERTYPE) && SOL_SAFE_USERTYPE
|
||||
if (!p) {
|
||||
luaL_error(L, "sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)", detail::demangle<T>().c_str());
|
||||
luaL_error(L,
|
||||
"sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)",
|
||||
detail::demangle<T>().c_str());
|
||||
}
|
||||
if (p.value() == nullptr) {
|
||||
luaL_error(L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
luaL_error(
|
||||
L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
}
|
||||
#endif // Safe getting with error
|
||||
return *p.value();
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2019-08-15 06:28:23.273623 UTC
|
||||
// This header was generated with sol v3.0.3 (revision cb3acaa)
|
||||
// Generated 2019-08-15 12:13:47.368988 UTC
|
||||
// This header was generated with sol v3.0.3 (revision c3c08df)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2019-08-15 06:28:22.668458 UTC
|
||||
// This header was generated with sol v3.0.3 (revision cb3acaa)
|
||||
// Generated 2019-08-15 12:13:46.408546 UTC
|
||||
// This header was generated with sol v3.0.3 (revision c3c08df)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -19027,7 +19027,8 @@ namespace sol {
|
|||
struct has_erase_after_test {
|
||||
private:
|
||||
template <typename C>
|
||||
static meta::sfinae_yes_t test(decltype(std::declval<C>().erase_after(std::declval<std::add_rvalue_reference_t<typename C::const_iterator>>()))*);
|
||||
static meta::sfinae_yes_t test(
|
||||
decltype(std::declval<C>().erase_after(std::declval<std::add_rvalue_reference_t<typename C::const_iterator>>()))*);
|
||||
template <typename C>
|
||||
static meta::sfinae_no_t test(...);
|
||||
|
||||
|
@ -19367,7 +19368,8 @@ namespace sol {
|
|||
}
|
||||
|
||||
static int index_set(lua_State* L) {
|
||||
return luaL_error(L, "sol: cannot call 'container[key] = value' on type '%s': it is not recognized as a container", detail::demangle<T>().c_str());
|
||||
return luaL_error(
|
||||
L, "sol: cannot call 'container[key] = value' on type '%s': it is not recognized as a container", detail::demangle<T>().c_str());
|
||||
}
|
||||
|
||||
static int add(lua_State* L) {
|
||||
|
@ -19426,7 +19428,9 @@ namespace sol {
|
|||
};
|
||||
|
||||
template <typename X>
|
||||
struct usertype_container_default<X, std::enable_if_t<meta::all<is_forced_container<meta::unqualified_t<X>>, meta::has_value_type<meta::unqualified_t<container_decay_t<X>>>, meta::has_iterator<meta::unqualified_t<container_decay_t<X>>>>::value>> {
|
||||
struct usertype_container_default<X,
|
||||
std::enable_if_t<meta::all<is_forced_container<meta::unqualified_t<X>>, meta::has_value_type<meta::unqualified_t<container_decay_t<X>>>,
|
||||
meta::has_iterator<meta::unqualified_t<container_decay_t<X>>>>::value>> {
|
||||
private:
|
||||
using T = std::remove_pointer_t<meta::unwrap_unqualified_t<container_decay_t<X>>>;
|
||||
|
||||
|
@ -19438,32 +19442,21 @@ namespace sol {
|
|||
using is_matched_lookup = meta::is_matched_lookup<T>;
|
||||
using iterator = typename T::iterator;
|
||||
using value_type = typename T::value_type;
|
||||
typedef meta::conditional_t<is_matched_lookup::value,
|
||||
std::pair<value_type, value_type>,
|
||||
meta::conditional_t<is_associative::value || is_lookup::value,
|
||||
value_type,
|
||||
std::pair<std::ptrdiff_t, value_type>>>
|
||||
typedef meta::conditional_t<is_matched_lookup::value, std::pair<value_type, value_type>,
|
||||
meta::conditional_t<is_associative::value || is_lookup::value, value_type, std::pair<std::ptrdiff_t, value_type>>>
|
||||
KV;
|
||||
typedef typename KV::first_type K;
|
||||
typedef typename KV::second_type V;
|
||||
typedef meta::conditional_t<is_matched_lookup::value, std::ptrdiff_t, K> next_K;
|
||||
typedef decltype(*std::declval<iterator&>()) iterator_return;
|
||||
typedef meta::conditional_t<is_associative::value || is_matched_lookup::value,
|
||||
std::add_lvalue_reference_t<V>,
|
||||
meta::conditional_t<is_lookup::value,
|
||||
V,
|
||||
iterator_return>>
|
||||
typedef meta::conditional_t<is_associative::value || is_matched_lookup::value, std::add_lvalue_reference_t<V>,
|
||||
meta::conditional_t<is_lookup::value, V, iterator_return>>
|
||||
captured_type;
|
||||
typedef typename meta::iterator_tag<iterator>::type iterator_category;
|
||||
typedef std::is_same<iterator_category, std::input_iterator_tag> is_input_iterator;
|
||||
typedef meta::conditional_t<is_input_iterator::value,
|
||||
V,
|
||||
decltype(detail::deref_non_pointer(std::declval<captured_type>()))>
|
||||
push_type;
|
||||
typedef meta::conditional_t<is_input_iterator::value, V, decltype(detail::deref_non_pointer(std::declval<captured_type>()))> push_type;
|
||||
typedef std::is_copy_assignable<V> is_copyable;
|
||||
typedef meta::neg<meta::any<
|
||||
std::is_const<V>, std::is_const<std::remove_reference_t<iterator_return>>, meta::neg<is_copyable>>>
|
||||
is_writable;
|
||||
typedef meta::neg<meta::any<std::is_const<V>, std::is_const<std::remove_reference_t<iterator_return>>, meta::neg<is_copyable>>> is_writable;
|
||||
typedef meta::unqualified_t<decltype(get_key(is_associative(), std::declval<std::add_lvalue_reference_t<value_type>>()))> key_type;
|
||||
typedef meta::all<std::is_integral<K>, meta::neg<meta::any<is_associative, is_lookup>>> is_linear_integral;
|
||||
|
||||
|
@ -19472,12 +19465,10 @@ namespace sol {
|
|||
iterator it;
|
||||
std::size_t i;
|
||||
|
||||
iter(T& source, iterator it)
|
||||
: source(source), it(std::move(it)), i(0) {
|
||||
iter(T& source, iterator it) : source(source), it(std::move(it)), i(0) {
|
||||
}
|
||||
|
||||
~iter() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19485,10 +19476,13 @@ namespace sol {
|
|||
#if defined(SOL_SAFE_USERTYPE) && SOL_SAFE_USERTYPE
|
||||
auto p = stack::unqualified_check_get<T*>(L, 1);
|
||||
if (!p) {
|
||||
luaL_error(L, "sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)", detail::demangle<T>().c_str());
|
||||
luaL_error(L,
|
||||
"sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)",
|
||||
detail::demangle<T>().c_str());
|
||||
}
|
||||
if (p.value() == nullptr) {
|
||||
luaL_error(L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
luaL_error(
|
||||
L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
}
|
||||
return *p.value();
|
||||
#else
|
||||
|
@ -19576,9 +19570,7 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result get_comparative(std::true_type, lua_State* L, T& self, K& key) {
|
||||
auto fx = [&](const value_type& r) -> bool {
|
||||
return key == get_key(is_associative(), r);
|
||||
};
|
||||
auto fx = [&](const value_type& r) -> bool { return key == get_key(is_associative(), r); };
|
||||
auto e = deferred_uc::end(L, self);
|
||||
auto it = std::find_if(deferred_uc::begin(L, self), e, std::ref(fx));
|
||||
if (it == e) {
|
||||
|
@ -19588,7 +19580,9 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result get_comparative(std::false_type, lua_State*, T&, K&) {
|
||||
return detail::error_result("cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'", detail::demangle<T>().data(), detail::demangle<K>().data());
|
||||
return detail::error_result("cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'",
|
||||
detail::demangle<T>().data(),
|
||||
detail::demangle<K>().data());
|
||||
}
|
||||
|
||||
static detail::error_result get_it(std::false_type, lua_State* L, T& self, K& key) {
|
||||
|
@ -19612,7 +19606,8 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result set_writable(std::false_type, lua_State*, T&, iterator&, stack_object) {
|
||||
return detail::error_result("cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
return detail::error_result(
|
||||
"cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
}
|
||||
|
||||
static detail::error_result set_category(std::input_iterator_tag, lua_State* L, T& self, stack_object okey, stack_object value) {
|
||||
|
@ -19653,11 +19648,10 @@ namespace sol {
|
|||
static detail::error_result set_comparative(std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
|
||||
decltype(auto) key = okey.as<K>();
|
||||
if (!is_writable::value) {
|
||||
return detail::error_result("cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
return detail::error_result(
|
||||
"cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)", detail::demangle<T>().data());
|
||||
}
|
||||
auto fx = [&](const value_type& r) -> bool {
|
||||
return key == get_key(is_associative(), r);
|
||||
};
|
||||
auto fx = [&](const value_type& r) -> bool { return key == get_key(is_associative(), r); };
|
||||
auto e = deferred_uc::end(L, self);
|
||||
auto it = std::find_if(deferred_uc::begin(L, self), e, std::ref(fx));
|
||||
if (it == e) {
|
||||
|
@ -19667,12 +19661,14 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result set_comparative(std::false_type, lua_State*, T&, stack_object, stack_object) {
|
||||
return detail::error_result("cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key", detail::demangle<T>().data(), detail::demangle<K>().data());
|
||||
return detail::error_result("cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key",
|
||||
detail::demangle<T>().data(),
|
||||
detail::demangle<K>().data());
|
||||
}
|
||||
|
||||
template <typename Iter>
|
||||
static detail::error_result set_associative_insert(std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
|
||||
if constexpr(meta::has_insert<T>::value) {
|
||||
if constexpr (meta::has_insert<T>::value) {
|
||||
self.insert(it, value_type(key, value.as<V>()));
|
||||
return {};
|
||||
}
|
||||
|
@ -19680,13 +19676,14 @@ namespace sol {
|
|||
(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());
|
||||
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>
|
||||
static detail::error_result set_associative_insert(std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
|
||||
if constexpr(has_insert<T>::value) {
|
||||
if constexpr (meta::has_insert<T>::value) {
|
||||
self.insert(it, key);
|
||||
return {};
|
||||
}
|
||||
|
@ -19694,7 +19691,8 @@ namespace sol {
|
|||
(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());
|
||||
return detail::error_result(
|
||||
"cannot call 'set' on '%s': there is no 'insert' function on this non-associative type", detail::demangle<T>().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19785,7 +19783,8 @@ namespace sol {
|
|||
|
||||
template <bool = false>
|
||||
static detail::error_result find_comparative(std::false_type, lua_State*, T&) {
|
||||
return detail::error_result("cannot call 'find' on '%s': there is no 'find' function and the value_type is not equality comparable", detail::demangle<T>().c_str());
|
||||
return detail::error_result("cannot call 'find' on '%s': there is no 'find' function and the value_type is not equality comparable",
|
||||
detail::demangle<T>().c_str());
|
||||
}
|
||||
|
||||
template <bool idx_of = false>
|
||||
|
@ -19877,7 +19876,7 @@ namespace sol {
|
|||
|
||||
template <typename Iter>
|
||||
static detail::error_result add_associative(std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
|
||||
if constexpr(meta::has_insert<T>::value) {
|
||||
if constexpr (meta::has_insert<T>::value) {
|
||||
self.insert(pos, value_type(key.as<K>(), stack::unqualified_get<V>(L, 3)));
|
||||
return {};
|
||||
}
|
||||
|
@ -19886,7 +19885,8 @@ namespace sol {
|
|||
(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());
|
||||
return detail::error_result(
|
||||
"cannot call 'insert' on '%s': there is no 'insert' function on this associative type", detail::demangle<T>().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19953,7 +19953,8 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result insert_after_has(std::false_type, lua_State*, T&, stack_object, stack_object) {
|
||||
return detail::error_result("cannot call 'insert' on '%s': no suitable or similar functionality detected on this container", detail::demangle<T>().data());
|
||||
return detail::error_result(
|
||||
"cannot call 'insert' on '%s': no suitable or similar functionality detected on this container", detail::demangle<T>().data());
|
||||
}
|
||||
|
||||
static detail::error_result insert_has(std::true_type, lua_State* L, T& self, stack_object key, stack_object value) {
|
||||
|
@ -19982,9 +19983,7 @@ namespace sol {
|
|||
}
|
||||
|
||||
static detail::error_result erase_integral(std::false_type, lua_State* L, T& self, const K& key) {
|
||||
auto fx = [&](const value_type& r) -> bool {
|
||||
return key == r;
|
||||
};
|
||||
auto fx = [&](const value_type& r) -> bool { return key == r; };
|
||||
auto e = deferred_uc::end(L, self);
|
||||
auto it = std::find_if(deferred_uc::begin(L, self), e, std::ref(fx));
|
||||
if (it == e) {
|
||||
|
@ -20069,7 +20068,7 @@ namespace sol {
|
|||
}
|
||||
|
||||
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);
|
||||
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) {
|
||||
|
@ -20296,8 +20295,7 @@ namespace sol {
|
|||
T& source;
|
||||
iterator it;
|
||||
|
||||
iter(T& source, iterator it)
|
||||
: source(source), it(std::move(it)) {
|
||||
iter(T& source, iterator it) : source(source), it(std::move(it)) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -20305,10 +20303,13 @@ namespace sol {
|
|||
auto p = stack::unqualified_check_get<T*>(L, 1);
|
||||
#if defined(SOL_SAFE_USERTYPE) && SOL_SAFE_USERTYPE
|
||||
if (!p) {
|
||||
luaL_error(L, "sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)", detail::demangle<T>().c_str());
|
||||
luaL_error(L,
|
||||
"sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)",
|
||||
detail::demangle<T>().c_str());
|
||||
}
|
||||
if (p.value() == nullptr) {
|
||||
luaL_error(L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
luaL_error(
|
||||
L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)", detail::demangle<T>().c_str());
|
||||
}
|
||||
#endif // Safe getting with error
|
||||
return *p.value();
|
||||
|
|
Loading…
Reference in New Issue
Block a user