mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
omegalul MSVC
This commit is contained in:
parent
ee13a7812f
commit
466e21bf7c
|
@ -170,8 +170,7 @@ namespace sol {
|
|||
}
|
||||
}
|
||||
stack::record tracking{};
|
||||
stack::stack_detail::check_types<true> ct{};
|
||||
if (!ct.check(args_list(), L, start, no_panic, tracking)) {
|
||||
if (!stack::stack_detail::check_types(args_list(), L, start, no_panic, tracking)) {
|
||||
return overload_match_arity(types<Fxs...>(),
|
||||
std::index_sequence<In...>(),
|
||||
std::index_sequence<M...>(),
|
||||
|
@ -261,8 +260,7 @@ namespace sol {
|
|||
}
|
||||
}
|
||||
stack::record tracking{};
|
||||
stack::stack_detail::check_types<true> ct{};
|
||||
if (!ct.check(args_list(), L, start, no_panic, tracking)) {
|
||||
if (!stack::stack_detail::check_types(args_list(), L, start, no_panic, tracking)) {
|
||||
return overload_match_arity(types<Fx1, Fxs...>(),
|
||||
std::index_sequence<I1, In...>(),
|
||||
std::index_sequence<M...>(),
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
// Interop allows userdata from external systems
|
||||
// with external memory layout and metatable names
|
||||
// to be registered. It costs something to perform
|
||||
// the unqualified_checker / differentiation for sol2 usertypes versus
|
||||
// the interop_checker / differentiation for sol2 usertypes versus
|
||||
// external ones however, so this is off by default
|
||||
#if !defined(SOL_ENABLE_INTEROP)
|
||||
// off by default here
|
||||
|
|
|
@ -130,13 +130,14 @@ namespace sol {
|
|||
template <bool checkargs = detail::default_safe_function_calls , std::size_t... I, typename R, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline decltype(auto) call(types<R>, types<Args...> ta, std::index_sequence<I...> tai, lua_State* L, int start, Fx&& fx, FxArgs&&... args) {
|
||||
static_assert(meta::all<meta::is_not_move_only<Args>...>::value, "One of the arguments being bound is a move-only type, and it is not being taken by reference: this will break your code. Please take a reference and std::move it manually if this was your intention.");
|
||||
if constexpr (checkargs) {
|
||||
argument_handler<types<R, Args...>> handler{};
|
||||
multi_check<checkargs, Args...>(L, start, handler);
|
||||
multi_check<Args...>(L, start, handler);
|
||||
}
|
||||
record tracking{};
|
||||
if constexpr (std::is_void_v<R>) {
|
||||
eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
else {
|
||||
return eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
|
|
@ -58,9 +58,6 @@ namespace stack {
|
|||
}
|
||||
return stack_detail::unchecked_get<T>(L, index, tracking);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, bool>) {
|
||||
return lua_toboolean(L, index) != 0;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) {
|
||||
#if SOL_LUA_VERSION >= 503
|
||||
if (lua_isinteger(L, index) != 0) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace sol {
|
||||
namespace stack {
|
||||
|
||||
template <typename X, type expected, typename>
|
||||
template <typename X, type expected = lua_type_of_v<meta::unqualified_t<X>>, typename = void>
|
||||
struct qualified_checker {
|
||||
template <typename Handler>
|
||||
static bool check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace sol { namespace stack {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T, type expected, typename>
|
||||
template <typename T, type expected = lua_type_of_v<T>, typename = void>
|
||||
struct unqualified_checker {
|
||||
template <typename Handler>
|
||||
static bool check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
|
@ -99,7 +99,10 @@ namespace sol { namespace stack {
|
|||
}
|
||||
return success;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) {
|
||||
else if constexpr (meta::any_same_v<T, char /* , char8_t*/, char16_t, char32_t>) {
|
||||
return stack::check<std::basic_string<T>>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T>) {
|
||||
tracking.use(1);
|
||||
#if SOL_LUA_VERSION >= 503
|
||||
#if defined(SOL_STRINGS_ARE_NUMBERS) && SOL_STRINGS_ARE_NUMBERS
|
||||
|
@ -177,6 +180,9 @@ namespace sol { namespace stack {
|
|||
#endif // Strings are Numbers
|
||||
}
|
||||
else if constexpr(meta::any_same_v<T, type, this_state, this_main_state, this_environment, variadic_args>) {
|
||||
(void)L;
|
||||
(void)index;
|
||||
(void)handler;
|
||||
tracking.use(0);
|
||||
return true;
|
||||
}
|
||||
|
@ -471,7 +477,7 @@ namespace sol { namespace stack {
|
|||
template <typename Handler>
|
||||
static bool check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
const type indextype = type_of(L, index);
|
||||
return check(L, index, indextype, handler, tracking);
|
||||
return check(L, index, indextype, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -573,31 +573,35 @@ namespace sol {
|
|||
|
||||
namespace stack {
|
||||
|
||||
template <typename T>
|
||||
struct extensible {};
|
||||
|
||||
template <typename T, bool global = false, bool raw = false, typename = void>
|
||||
struct field_getter;
|
||||
template <typename T, typename P, bool global = false, bool raw = false, typename = void>
|
||||
struct probe_field_getter;
|
||||
|
||||
template <typename T, bool global = false, bool raw = false, typename = void>
|
||||
struct field_setter;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_getter;
|
||||
template <typename T, typename = void>
|
||||
struct qualified_getter;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct qualified_interop_getter;
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_interop_getter;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct popper;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_pusher;
|
||||
template <typename X, type t = lua_type_of_v<X>, typename C = void>
|
||||
|
||||
template <typename T, type t, typename>
|
||||
struct unqualified_checker;
|
||||
template <typename X, type t = lua_type_of_v<X>, typename C = void>
|
||||
template <typename T, type t, typename>
|
||||
struct qualified_checker;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_check_getter;
|
||||
template <typename T, typename = void>
|
||||
|
@ -707,19 +711,6 @@ namespace sol {
|
|||
template <typename T>
|
||||
using strip_t = typename strip<T>::type;
|
||||
|
||||
template <typename T>
|
||||
struct strip_extensible {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct strip_extensible<extensible<T>> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using strip_extensible_t = typename strip_extensible<T>::type;
|
||||
|
||||
template <typename C>
|
||||
static int get_size_hint(C& c) {
|
||||
return static_cast<int>(c.size());
|
||||
|
@ -767,7 +758,7 @@ namespace sol {
|
|||
(void)index;
|
||||
(void)unadjusted_pointer;
|
||||
(void)tracking;
|
||||
using Ti = stack_detail::strip_extensible_t<Tu>;
|
||||
using Ti = stack_detail::strip_t<Tu>;
|
||||
return std::pair<bool, Ti*>{ false, nullptr };
|
||||
}
|
||||
}
|
||||
|
@ -1058,63 +1049,39 @@ namespace sol {
|
|||
|
||||
namespace stack_detail {
|
||||
|
||||
template <bool b>
|
||||
struct check_types {
|
||||
template <typename T, typename... Args, typename Handler>
|
||||
static bool check(types<T, Args...>, lua_State* L, int firstargument, Handler&& handler, record& tracking) {
|
||||
inline bool check_types(lua_State* L, int firstargument, Handler&& handler, record& tracking) {
|
||||
if (!stack::check<T>(L, firstargument + tracking.used, handler, tracking))
|
||||
return false;
|
||||
return check(types<Args...>(), L, firstargument, std::forward<Handler>(handler), tracking);
|
||||
return check_types<Args...>(L, firstargument, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
static bool check(types<>, lua_State*, int, Handler&&, record&) {
|
||||
static bool check_types(lua_State*, int, Handler&&, record&) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct check_types<false> {
|
||||
template <typename... Args, typename Handler>
|
||||
static bool check(types<Args...>, lua_State*, int, Handler&&, record&) {
|
||||
return true;
|
||||
bool check_types(types<Args...>, lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
return check_types<Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace stack_detail
|
||||
|
||||
template <bool b, typename... Args, typename Handler>
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
return stack_detail::check_types<b>{}.check(types<meta::unqualified_t<Args>...>(), L, index, std::forward<Handler>(handler), tracking);
|
||||
return stack_detail::check_types<Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <bool b, typename... Args, typename Handler>
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler) {
|
||||
record tracking{};
|
||||
return multi_check<b, Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <bool b, typename... Args>
|
||||
bool multi_check(lua_State* L, int index) {
|
||||
auto handler = no_panic;
|
||||
return multi_check<b, Args...>(L, index, handler);
|
||||
}
|
||||
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
return multi_check<true, Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler) {
|
||||
return multi_check<true, Args...>(L, index, std::forward<Handler>(handler));
|
||||
return multi_check<Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
bool multi_check(lua_State* L, int index) {
|
||||
return multi_check<true, Args...>(L, index);
|
||||
return multi_check<Args...>(L, index);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace stack {
|
|||
(void)tableindex;
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, env_key_t>) {
|
||||
(void)key;
|
||||
#if SOL_LUA_VERSION < 502
|
||||
// Use lua_setfenv
|
||||
lua_getfenv(L, tableindex);
|
||||
|
@ -56,6 +57,7 @@ namespace stack {
|
|||
#endif
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, metatable_key_t>) {
|
||||
(void)key;
|
||||
if (lua_getmetatable(L, tableindex) == 0)
|
||||
push(L, lua_nil);
|
||||
}
|
||||
|
@ -154,6 +156,7 @@ namespace stack {
|
|||
(void)tableindex;
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, metatable_key_t>) {
|
||||
(void)key;
|
||||
push(L, std::forward<Value>(value));
|
||||
lua_setmetatable(L, tableindex);
|
||||
}
|
||||
|
@ -165,7 +168,7 @@ namespace stack {
|
|||
#if SOL_LUA_VERSION >= 502
|
||||
else if constexpr (std::is_void_v<std::remove_pointer_t<T>>) {
|
||||
push(L, std::forward<Value>(value));
|
||||
lua_rawsetp(L, tableindex, key);
|
||||
lua_rawsetp(L, tableindex, std::forward<Key>(key));
|
||||
}
|
||||
#endif // Lua 5.2.x
|
||||
else {
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
namespace sol {
|
||||
namespace stack {
|
||||
|
||||
// There are no more enable_ifs that can be used here,
|
||||
// so this is just for posterity, I guess?
|
||||
// maybe I'll fill this file in later.
|
||||
|
||||
}
|
||||
} // namespace sol::stack
|
||||
|
||||
|
|
|
@ -163,8 +163,10 @@ namespace sol { namespace stack {
|
|||
struct qualified_getter {
|
||||
static decltype(auto) get(lua_State* L, int index, record& tracking) {
|
||||
using Tu = meta::unqualified_t<X>;
|
||||
if constexpr (!std::is_reference_v<X> && is_container_v<Tu>
|
||||
&& std::is_default_constructible_v<Tu> && !is_lua_primitive_v<Tu> && !is_transparent_argument_v<Tu>) {
|
||||
static constexpr bool is_userdata_of_some_kind
|
||||
= !std::is_reference_v<
|
||||
X> && is_container_v<Tu> && std::is_default_constructible_v<Tu> && !is_lua_primitive_v<Tu> && !is_transparent_argument_v<Tu>;
|
||||
if constexpr (is_userdata_of_some_kind) {
|
||||
if (type_of(L, index) == type::userdata) {
|
||||
return static_cast<Tu>(stack_detail::unchecked_unqualified_get<Tu>(L, index, tracking));
|
||||
}
|
||||
|
@ -172,8 +174,8 @@ namespace sol { namespace stack {
|
|||
return stack_detail::unchecked_unqualified_get<sol::nested<Tu>>(L, index, tracking);
|
||||
}
|
||||
}
|
||||
else if constexpr (!std::is_reference_v<X> && is_unique_usertype_v<Tu>
|
||||
&& !std::is_void_v<typename unique_usertype_traits<Tu>::template rebind_base<void>>) {
|
||||
else if constexpr (!std::is_reference_v<
|
||||
X> && is_unique_usertype_v<Tu> && !std::is_void_v<typename unique_usertype_traits<Tu>::template rebind_base<void>>) {
|
||||
using u_traits = unique_usertype_traits<Tu>;
|
||||
using T = typename u_traits::type;
|
||||
using Real = typename u_traits::actual_type;
|
||||
|
@ -220,7 +222,7 @@ namespace sol { namespace stack {
|
|||
}
|
||||
}
|
||||
else {
|
||||
return stack::unqualified_get<Tu>(L, index, tracking);
|
||||
return stack_detail::unchecked_unqualified_get<Tu>(L, index, tracking);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,20 +34,18 @@ namespace stack {
|
|||
template <typename T, typename>
|
||||
struct popper {
|
||||
inline static decltype(auto) pop(lua_State* L) {
|
||||
if constexpr (is_stack_based_v<meta::unqualified_t<T>>) {
|
||||
static_assert(!is_stack_based_v<meta::unqualified_t<T>>,
|
||||
"You cannot pop something that lives solely on the stack: it will not remain on the stack when popped and thusly will go out of "
|
||||
"scope!");
|
||||
}
|
||||
else {
|
||||
record tracking{};
|
||||
#ifdef __INTEL_COMPILER
|
||||
auto&& r = get<T>(L, -lua_size<T>::value, tracking);
|
||||
#else
|
||||
decltype(auto) r = get<T>(L, -lua_size<T>::value, tracking);
|
||||
#endif
|
||||
lua_pop(L, tracking.used);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct popper<T, std::enable_if_t<is_stack_based<meta::unqualified_t<T>>::value>> {
|
||||
static_assert(meta::neg<is_stack_based<meta::unqualified_t<T>>>::value, "You cannot pop something that lives solely on the stack: it will not remain on the stack when popped and thusly will go out of scope!");
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace sol::stack
|
||||
|
|
|
@ -64,8 +64,13 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
int msvc_is_ass_with_if_constexpr_push_enum(std::true_type, lua_State* L, const T& value) {
|
||||
if constexpr (std::is_same_v<std::underlying_type_t<T>, char>) {
|
||||
return stack::push(L, static_cast<int>(value));
|
||||
if constexpr (meta::any_same_v<std::underlying_type_t<T>, char/*, char8_t*/, char16_t, char32_t>) {
|
||||
if constexpr (std::is_signed_v<T>) {
|
||||
return stack::push(L, static_cast<std::int_least32_t>(value));
|
||||
}
|
||||
else {
|
||||
return stack::push(L, static_cast<std::uint_least32_t>(value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return stack::push(L, static_cast<std::underlying_type_t<T>>(value));
|
||||
|
@ -130,6 +135,7 @@ namespace sol {
|
|||
template <typename Arg, typename... Args>
|
||||
static int push(lua_State* L, Arg&& arg, Args&&... args) {
|
||||
if constexpr (std::is_same_v<meta::unqualified_t<Arg>, detail::with_function_tag>) {
|
||||
(void)arg;
|
||||
return push_fx(L, std::forward<Args>(args)...);
|
||||
}
|
||||
else {
|
||||
|
@ -168,6 +174,7 @@ namespace sol {
|
|||
template <typename Arg, typename... Args>
|
||||
static int push(lua_State* L, Arg&& arg, Args&&... args) {
|
||||
if constexpr (std::is_same_v<meta::unqualified_t<Arg>, detail::with_function_tag>) {
|
||||
(void)arg;
|
||||
return push_fx(L, std::forward<Args>(args)...);
|
||||
}
|
||||
else {
|
||||
|
@ -314,6 +321,10 @@ namespace sol {
|
|||
return push(has_kvp(), std::false_type(), L, tablecont);
|
||||
}
|
||||
|
||||
static int push(lua_State* L, const T& tablecont, nested_tag_t) {
|
||||
return push(has_kvp(), std::true_type(), L, tablecont);
|
||||
}
|
||||
|
||||
static int push(std::true_type, lua_State* L, const T& tablecont) {
|
||||
return push(has_kvp(), std::true_type(), L, tablecont);
|
||||
}
|
||||
|
@ -400,7 +411,7 @@ namespace sol {
|
|||
static int push(lua_State* L, const T& tablecont) {
|
||||
using inner_t = std::remove_pointer_t<meta::unwrap_unqualified_t<T>>;
|
||||
if constexpr (is_container_v<inner_t>) {
|
||||
return stack::push<detail::as_table_tag<T>>(L, tablecont);
|
||||
return stack::push<detail::as_table_tag<T>>(L, tablecont, nested_tag);
|
||||
}
|
||||
else {
|
||||
return stack::push<inner_t>(L, tablecont);
|
||||
|
@ -596,6 +607,7 @@ namespace sol {
|
|||
return push_with<true>(L, name, std::forward<Args>(args)...);
|
||||
}
|
||||
else if constexpr (std::is_same_v<meta::unqualified_t<Arg>, no_metatable_t>) {
|
||||
(void)arg;
|
||||
const auto name = &usertype_traits<meta::unqualified_t<T>>::user_gc_metatable()[0];
|
||||
return push_with<false>(L, name, std::forward<Args>(args)...);
|
||||
}
|
||||
|
|
|
@ -454,6 +454,9 @@ namespace sol {
|
|||
}
|
||||
};
|
||||
|
||||
struct nested_tag_t {};
|
||||
constexpr inline nested_tag_t nested_tag{};
|
||||
|
||||
template <typename T>
|
||||
as_table_t<T> as_table_ref(T&& container) {
|
||||
return as_table_t<T>(std::forward<T>(container));
|
||||
|
|
|
@ -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-03-10 01:57:28.833449 UTC
|
||||
// This header was generated with sol v3.0.0 (revision b6f4093)
|
||||
// Generated 2019-03-10 15:09:32.665841 UTC
|
||||
// This header was generated with sol v3.0.0 (revision ee13a78)
|
||||
// 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-03-10 01:57:28.472452 UTC
|
||||
// This header was generated with sol v3.0.0 (revision b6f4093)
|
||||
// Generated 2019-03-10 15:09:32.355673 UTC
|
||||
// This header was generated with sol v3.0.0 (revision ee13a78)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -6449,6 +6449,9 @@ namespace sol {
|
|||
}
|
||||
};
|
||||
|
||||
struct nested_tag_t {};
|
||||
constexpr inline nested_tag_t nested_tag{};
|
||||
|
||||
template <typename T>
|
||||
as_table_t<T> as_table_ref(T&& container) {
|
||||
return as_table_t<T>(std::forward<T>(container));
|
||||
|
@ -9433,31 +9436,35 @@ namespace sol {
|
|||
|
||||
namespace stack {
|
||||
|
||||
template <typename T>
|
||||
struct extensible {};
|
||||
|
||||
template <typename T, bool global = false, bool raw = false, typename = void>
|
||||
struct field_getter;
|
||||
template <typename T, typename P, bool global = false, bool raw = false, typename = void>
|
||||
struct probe_field_getter;
|
||||
|
||||
template <typename T, bool global = false, bool raw = false, typename = void>
|
||||
struct field_setter;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_getter;
|
||||
template <typename T, typename = void>
|
||||
struct qualified_getter;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct qualified_interop_getter;
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_interop_getter;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct popper;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_pusher;
|
||||
template <typename X, type t = lua_type_of_v<X>, typename C = void>
|
||||
|
||||
template <typename T, type t, typename>
|
||||
struct unqualified_checker;
|
||||
template <typename X, type t = lua_type_of_v<X>, typename C = void>
|
||||
template <typename T, type t, typename>
|
||||
struct qualified_checker;
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct unqualified_check_getter;
|
||||
template <typename T, typename = void>
|
||||
|
@ -9566,19 +9573,6 @@ namespace sol {
|
|||
template <typename T>
|
||||
using strip_t = typename strip<T>::type;
|
||||
|
||||
template <typename T>
|
||||
struct strip_extensible {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct strip_extensible<extensible<T>> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using strip_extensible_t = typename strip_extensible<T>::type;
|
||||
|
||||
template <typename C>
|
||||
static int get_size_hint(C& c) {
|
||||
return static_cast<int>(c.size());
|
||||
|
@ -9626,7 +9620,7 @@ namespace sol {
|
|||
(void)index;
|
||||
(void)unadjusted_pointer;
|
||||
(void)tracking;
|
||||
using Ti = stack_detail::strip_extensible_t<Tu>;
|
||||
using Ti = stack_detail::strip_t<Tu>;
|
||||
return std::pair<bool, Ti*>{ false, nullptr };
|
||||
}
|
||||
}
|
||||
|
@ -9917,61 +9911,39 @@ namespace sol {
|
|||
|
||||
namespace stack_detail {
|
||||
|
||||
template <bool b>
|
||||
struct check_types {
|
||||
template <typename T, typename... Args, typename Handler>
|
||||
static bool check(types<T, Args...>, lua_State* L, int firstargument, Handler&& handler, record& tracking) {
|
||||
inline bool check_types(lua_State* L, int firstargument, Handler&& handler, record& tracking) {
|
||||
if (!stack::check<T>(L, firstargument + tracking.used, handler, tracking))
|
||||
return false;
|
||||
return check(types<Args...>(), L, firstargument, std::forward<Handler>(handler), tracking);
|
||||
return check_types<Args...>(L, firstargument, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
static bool check(types<>, lua_State*, int, Handler&&, record&) {
|
||||
static bool check_types(lua_State*, int, Handler&&, record&) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct check_types<false> {
|
||||
template <typename... Args, typename Handler>
|
||||
static bool check(types<Args...>, lua_State*, int, Handler&&, record&) {
|
||||
return true;
|
||||
bool check_types(types<Args...>, lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
return check_types<Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace stack_detail
|
||||
|
||||
template <bool b, typename... Args, typename Handler>
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
return stack_detail::check_types<b>{}.check(types<meta::unqualified_t<Args>...>(), L, index, std::forward<Handler>(handler), tracking);
|
||||
return stack_detail::check_types<Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <bool b, typename... Args, typename Handler>
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler) {
|
||||
record tracking{};
|
||||
return multi_check<b, Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <bool b, typename... Args>
|
||||
bool multi_check(lua_State* L, int index) {
|
||||
auto handler = no_panic;
|
||||
return multi_check<b, Args...>(L, index, handler);
|
||||
}
|
||||
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
return multi_check<true, Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <typename... Args, typename Handler>
|
||||
bool multi_check(lua_State* L, int index, Handler&& handler) {
|
||||
return multi_check<true, Args...>(L, index, std::forward<Handler>(handler));
|
||||
return multi_check<Args...>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
bool multi_check(lua_State* L, int index) {
|
||||
return multi_check<true, Args...>(L, index);
|
||||
return multi_check<Args...>(L, index);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -10335,7 +10307,7 @@ namespace sol { namespace stack {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T, type expected, typename>
|
||||
template <typename T, type expected = lua_type_of_v<T>, typename = void>
|
||||
struct unqualified_checker {
|
||||
template <typename Handler>
|
||||
static bool check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
|
@ -10348,7 +10320,10 @@ namespace sol { namespace stack {
|
|||
}
|
||||
return success;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) {
|
||||
else if constexpr (meta::any_same_v<T, char /* , char8_t*/, char16_t, char32_t>) {
|
||||
return stack::check<std::basic_string<T>>(L, index, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T>) {
|
||||
tracking.use(1);
|
||||
#if SOL_LUA_VERSION >= 503
|
||||
#if defined(SOL_STRINGS_ARE_NUMBERS) && SOL_STRINGS_ARE_NUMBERS
|
||||
|
@ -10426,6 +10401,9 @@ namespace sol { namespace stack {
|
|||
#endif // Strings are Numbers
|
||||
}
|
||||
else if constexpr(meta::any_same_v<T, type, this_state, this_main_state, this_environment, variadic_args>) {
|
||||
(void)L;
|
||||
(void)index;
|
||||
(void)handler;
|
||||
tracking.use(0);
|
||||
return true;
|
||||
}
|
||||
|
@ -10720,7 +10698,7 @@ namespace sol { namespace stack {
|
|||
template <typename Handler>
|
||||
static bool check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
const type indextype = type_of(L, index);
|
||||
return check(L, index, indextype, handler, tracking);
|
||||
return check(L, index, indextype, std::forward<Handler>(handler), tracking);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -10825,7 +10803,7 @@ namespace sol { namespace stack {
|
|||
namespace sol {
|
||||
namespace stack {
|
||||
|
||||
template <typename X, type expected, typename>
|
||||
template <typename X, type expected = lua_type_of_v<meta::unqualified_t<X>>, typename = void>
|
||||
struct qualified_checker {
|
||||
template <typename Handler>
|
||||
static bool check(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
|
@ -11345,8 +11323,10 @@ namespace sol { namespace stack {
|
|||
struct qualified_getter {
|
||||
static decltype(auto) get(lua_State* L, int index, record& tracking) {
|
||||
using Tu = meta::unqualified_t<X>;
|
||||
if constexpr (!std::is_reference_v<X> && is_container_v<Tu>
|
||||
&& std::is_default_constructible_v<Tu> && !is_lua_primitive_v<Tu> && !is_transparent_argument_v<Tu>) {
|
||||
static constexpr bool is_userdata_of_some_kind
|
||||
= !std::is_reference_v<
|
||||
X> && is_container_v<Tu> && std::is_default_constructible_v<Tu> && !is_lua_primitive_v<Tu> && !is_transparent_argument_v<Tu>;
|
||||
if constexpr (is_userdata_of_some_kind) {
|
||||
if (type_of(L, index) == type::userdata) {
|
||||
return static_cast<Tu>(stack_detail::unchecked_unqualified_get<Tu>(L, index, tracking));
|
||||
}
|
||||
|
@ -11354,8 +11334,8 @@ namespace sol { namespace stack {
|
|||
return stack_detail::unchecked_unqualified_get<sol::nested<Tu>>(L, index, tracking);
|
||||
}
|
||||
}
|
||||
else if constexpr (!std::is_reference_v<X> && is_unique_usertype_v<Tu>
|
||||
&& !std::is_void_v<typename unique_usertype_traits<Tu>::template rebind_base<void>>) {
|
||||
else if constexpr (!std::is_reference_v<
|
||||
X> && is_unique_usertype_v<Tu> && !std::is_void_v<typename unique_usertype_traits<Tu>::template rebind_base<void>>) {
|
||||
using u_traits = unique_usertype_traits<Tu>;
|
||||
using T = typename u_traits::type;
|
||||
using Real = typename u_traits::actual_type;
|
||||
|
@ -11402,7 +11382,7 @@ namespace sol { namespace stack {
|
|||
}
|
||||
}
|
||||
else {
|
||||
return stack::unqualified_get<Tu>(L, index, tracking);
|
||||
return stack_detail::unchecked_unqualified_get<Tu>(L, index, tracking);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -12200,6 +12180,10 @@ namespace sol { namespace stack {
|
|||
namespace sol {
|
||||
namespace stack {
|
||||
|
||||
// There are no more enable_ifs that can be used here,
|
||||
// so this is just for posterity, I guess?
|
||||
// maybe I'll fill this file in later.
|
||||
|
||||
}
|
||||
} // namespace sol::stack
|
||||
|
||||
|
@ -12235,9 +12219,6 @@ namespace stack {
|
|||
}
|
||||
return stack_detail::unchecked_get<T>(L, index, tracking);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, bool>) {
|
||||
return lua_toboolean(L, index) != 0;
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) {
|
||||
#if SOL_LUA_VERSION >= 503
|
||||
if (lua_isinteger(L, index) != 0) {
|
||||
|
@ -12458,8 +12439,13 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
int msvc_is_ass_with_if_constexpr_push_enum(std::true_type, lua_State* L, const T& value) {
|
||||
if constexpr (std::is_same_v<std::underlying_type_t<T>, char>) {
|
||||
return stack::push(L, static_cast<int>(value));
|
||||
if constexpr (meta::any_same_v<std::underlying_type_t<T>, char/*, char8_t*/, char16_t, char32_t>) {
|
||||
if constexpr (std::is_signed_v<T>) {
|
||||
return stack::push(L, static_cast<std::int_least32_t>(value));
|
||||
}
|
||||
else {
|
||||
return stack::push(L, static_cast<std::uint_least32_t>(value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return stack::push(L, static_cast<std::underlying_type_t<T>>(value));
|
||||
|
@ -12524,6 +12510,7 @@ namespace sol {
|
|||
template <typename Arg, typename... Args>
|
||||
static int push(lua_State* L, Arg&& arg, Args&&... args) {
|
||||
if constexpr (std::is_same_v<meta::unqualified_t<Arg>, detail::with_function_tag>) {
|
||||
(void)arg;
|
||||
return push_fx(L, std::forward<Args>(args)...);
|
||||
}
|
||||
else {
|
||||
|
@ -12562,6 +12549,7 @@ namespace sol {
|
|||
template <typename Arg, typename... Args>
|
||||
static int push(lua_State* L, Arg&& arg, Args&&... args) {
|
||||
if constexpr (std::is_same_v<meta::unqualified_t<Arg>, detail::with_function_tag>) {
|
||||
(void)arg;
|
||||
return push_fx(L, std::forward<Args>(args)...);
|
||||
}
|
||||
else {
|
||||
|
@ -12708,6 +12696,10 @@ namespace sol {
|
|||
return push(has_kvp(), std::false_type(), L, tablecont);
|
||||
}
|
||||
|
||||
static int push(lua_State* L, const T& tablecont, nested_tag_t) {
|
||||
return push(has_kvp(), std::true_type(), L, tablecont);
|
||||
}
|
||||
|
||||
static int push(std::true_type, lua_State* L, const T& tablecont) {
|
||||
return push(has_kvp(), std::true_type(), L, tablecont);
|
||||
}
|
||||
|
@ -12794,7 +12786,7 @@ namespace sol {
|
|||
static int push(lua_State* L, const T& tablecont) {
|
||||
using inner_t = std::remove_pointer_t<meta::unwrap_unqualified_t<T>>;
|
||||
if constexpr (is_container_v<inner_t>) {
|
||||
return stack::push<detail::as_table_tag<T>>(L, tablecont);
|
||||
return stack::push<detail::as_table_tag<T>>(L, tablecont, nested_tag);
|
||||
}
|
||||
else {
|
||||
return stack::push<inner_t>(L, tablecont);
|
||||
|
@ -12990,6 +12982,7 @@ namespace sol {
|
|||
return push_with<true>(L, name, std::forward<Args>(args)...);
|
||||
}
|
||||
else if constexpr (std::is_same_v<meta::unqualified_t<Arg>, no_metatable_t>) {
|
||||
(void)arg;
|
||||
const auto name = &usertype_traits<meta::unqualified_t<T>>::user_gc_metatable()[0];
|
||||
return push_with<false>(L, name, std::forward<Args>(args)...);
|
||||
}
|
||||
|
@ -13581,20 +13574,18 @@ namespace stack {
|
|||
template <typename T, typename>
|
||||
struct popper {
|
||||
inline static decltype(auto) pop(lua_State* L) {
|
||||
if constexpr (is_stack_based_v<meta::unqualified_t<T>>) {
|
||||
static_assert(!is_stack_based_v<meta::unqualified_t<T>>,
|
||||
"You cannot pop something that lives solely on the stack: it will not remain on the stack when popped and thusly will go out of "
|
||||
"scope!");
|
||||
}
|
||||
else {
|
||||
record tracking{};
|
||||
#ifdef __INTEL_COMPILER
|
||||
auto&& r = get<T>(L, -lua_size<T>::value, tracking);
|
||||
#else
|
||||
decltype(auto) r = get<T>(L, -lua_size<T>::value, tracking);
|
||||
#endif
|
||||
lua_pop(L, tracking.used);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct popper<T, std::enable_if_t<is_stack_based<meta::unqualified_t<T>>::value>> {
|
||||
static_assert(meta::neg<is_stack_based<meta::unqualified_t<T>>>::value, "You cannot pop something that lives solely on the stack: it will not remain on the stack when popped and thusly will go out of scope!");
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace sol::stack
|
||||
|
@ -13619,6 +13610,7 @@ namespace stack {
|
|||
(void)tableindex;
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, env_key_t>) {
|
||||
(void)key;
|
||||
#if SOL_LUA_VERSION < 502
|
||||
// Use lua_setfenv
|
||||
lua_getfenv(L, tableindex);
|
||||
|
@ -13630,6 +13622,7 @@ namespace stack {
|
|||
#endif
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, metatable_key_t>) {
|
||||
(void)key;
|
||||
if (lua_getmetatable(L, tableindex) == 0)
|
||||
push(L, lua_nil);
|
||||
}
|
||||
|
@ -13728,6 +13721,7 @@ namespace stack {
|
|||
(void)tableindex;
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, metatable_key_t>) {
|
||||
(void)key;
|
||||
push(L, std::forward<Value>(value));
|
||||
lua_setmetatable(L, tableindex);
|
||||
}
|
||||
|
@ -13739,7 +13733,7 @@ namespace stack {
|
|||
#if SOL_LUA_VERSION >= 502
|
||||
else if constexpr (std::is_void_v<std::remove_pointer_t<T>>) {
|
||||
push(L, std::forward<Value>(value));
|
||||
lua_rawsetp(L, tableindex, key);
|
||||
lua_rawsetp(L, tableindex, std::forward<Key>(key));
|
||||
}
|
||||
#endif // Lua 5.2.x
|
||||
else {
|
||||
|
@ -13977,13 +13971,14 @@ namespace sol {
|
|||
template <bool checkargs = detail::default_safe_function_calls , std::size_t... I, typename R, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline decltype(auto) call(types<R>, types<Args...> ta, std::index_sequence<I...> tai, lua_State* L, int start, Fx&& fx, FxArgs&&... args) {
|
||||
static_assert(meta::all<meta::is_not_move_only<Args>...>::value, "One of the arguments being bound is a move-only type, and it is not being taken by reference: this will break your code. Please take a reference and std::move it manually if this was your intention.");
|
||||
if constexpr (checkargs) {
|
||||
argument_handler<types<R, Args...>> handler{};
|
||||
multi_check<checkargs, Args...>(L, start, handler);
|
||||
multi_check<Args...>(L, start, handler);
|
||||
}
|
||||
record tracking{};
|
||||
if constexpr (std::is_void_v<R>) {
|
||||
eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
else {
|
||||
return eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
@ -15609,8 +15604,7 @@ namespace sol {
|
|||
}
|
||||
}
|
||||
stack::record tracking{};
|
||||
stack::stack_detail::check_types<true> ct{};
|
||||
if (!ct.check(args_list(), L, start, no_panic, tracking)) {
|
||||
if (!stack::stack_detail::check_types(args_list(), L, start, no_panic, tracking)) {
|
||||
return overload_match_arity(types<Fxs...>(),
|
||||
std::index_sequence<In...>(),
|
||||
std::index_sequence<M...>(),
|
||||
|
@ -15700,8 +15694,7 @@ namespace sol {
|
|||
}
|
||||
}
|
||||
stack::record tracking{};
|
||||
stack::stack_detail::check_types<true> ct{};
|
||||
if (!ct.check(args_list(), L, start, no_panic, tracking)) {
|
||||
if (!stack::stack_detail::check_types(args_list(), L, start, no_panic, tracking)) {
|
||||
return overload_match_arity(types<Fx1, Fxs...>(),
|
||||
std::index_sequence<I1, In...>(),
|
||||
std::index_sequence<M...>(),
|
||||
|
|
|
@ -284,9 +284,9 @@ TEST_CASE("containers/deeply nested", "make sure nested works for deeply-nested
|
|||
list.push_back(info_t{ { "a", "b" } });
|
||||
}
|
||||
|
||||
sol::nested<info_vector> getList() {
|
||||
return sol::nested<info_vector>(list);
|
||||
};
|
||||
sol::nested<info_vector&> getList() {
|
||||
return sol::nested<info_vector&>(list);
|
||||
}
|
||||
};
|
||||
|
||||
sol::state lua;
|
||||
|
|
|
@ -121,7 +121,7 @@ TEST_CASE("customization/split struct", "using the old customization points to h
|
|||
sol::state lua;
|
||||
|
||||
// Create a pass-through style of function
|
||||
auto result1 = lua.safe_script("function f ( a, b, c ) return a + c, b end");
|
||||
auto result1 = lua.safe_script("function f ( a, b, c ) return a + c, b end", sol::script_pass_on_error);
|
||||
REQUIRE(result1.valid());
|
||||
lua.set_function("g", [](int a, bool b, int c, double d) { return std::make_tuple(a + c, b, d + 2.5); });
|
||||
|
||||
|
@ -130,12 +130,12 @@ TEST_CASE("customization/split struct", "using the old customization points to h
|
|||
sol::function g = lua["g"];
|
||||
|
||||
two_things thingsf = f(two_things{ 24, true }, 1);
|
||||
two_things thingsg;
|
||||
double d;
|
||||
sol::tie(thingsg, d) = g(two_things{ 25, false }, 2, 34.0);
|
||||
REQUIRE(thingsf.a == 25);
|
||||
REQUIRE(thingsf.b);
|
||||
|
||||
two_things thingsg;
|
||||
double d;
|
||||
sol::tie(thingsg, d) = g(two_things{ 25, false }, 2, 34.0);
|
||||
REQUIRE(thingsg.a == 27);
|
||||
REQUIRE_FALSE(thingsg.b);
|
||||
REQUIRE(d == 36.5);
|
||||
|
|
|
@ -68,6 +68,7 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
lua["utf32"] = utf32str;
|
||||
lua["wide"] = widestr;
|
||||
|
||||
SECTION("to_utf8") {
|
||||
std::string utf8_to_utf8 = lua["utf8"];
|
||||
std::string utf16_to_utf8 = lua["utf16"];
|
||||
std::string utf32_to_utf8 = lua["utf32"];
|
||||
|
@ -77,7 +78,8 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
REQUIRE(utf16_to_utf8 == utf8str_s);
|
||||
REQUIRE(utf32_to_utf8 == utf8str_s);
|
||||
REQUIRE(wide_to_utf8 == utf8str_s);
|
||||
|
||||
}
|
||||
SECTION("to_wide") {
|
||||
std::wstring utf8_to_wide = lua["utf8"];
|
||||
std::wstring utf16_to_wide = lua["utf16"];
|
||||
std::wstring utf32_to_wide = lua["utf32"];
|
||||
|
@ -87,7 +89,8 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
REQUIRE(utf16_to_wide == widestr_s);
|
||||
REQUIRE(utf32_to_wide == widestr_s);
|
||||
REQUIRE(wide_to_wide == widestr_s);
|
||||
|
||||
}
|
||||
SECTION("to_utf16") {
|
||||
std::u16string utf8_to_utf16 = lua["utf8"];
|
||||
std::u16string utf16_to_utf16 = lua["utf16"];
|
||||
std::u16string utf32_to_utf16 = lua["utf32"];
|
||||
|
@ -97,7 +100,8 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
REQUIRE(utf16_to_utf16 == utf16str_s);
|
||||
REQUIRE(utf32_to_utf16 == utf16str_s);
|
||||
REQUIRE(wide_to_utf16 == utf16str_s);
|
||||
|
||||
}
|
||||
SECTION("to_utf32") {
|
||||
std::u32string utf8_to_utf32 = lua["utf8"];
|
||||
std::u32string utf16_to_utf32 = lua["utf16"];
|
||||
std::u32string utf32_to_utf32 = lua["utf32"];
|
||||
|
@ -107,7 +111,8 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
REQUIRE(utf16_to_utf32 == utf32str_s);
|
||||
REQUIRE(utf32_to_utf32 == utf32str_s);
|
||||
REQUIRE(wide_to_utf32 == utf32str_s);
|
||||
|
||||
}
|
||||
SECTION("to_char32_t") {
|
||||
char32_t utf8_to_char32 = lua["utf8"];
|
||||
char32_t utf16_to_char32 = lua["utf16"];
|
||||
char32_t utf32_to_char32 = lua["utf32"];
|
||||
|
@ -117,7 +122,8 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
REQUIRE(utf16_to_char32 == utf32str[0]);
|
||||
REQUIRE(utf32_to_char32 == utf32str[0]);
|
||||
REQUIRE(wide_to_char32 == utf32str[0]);
|
||||
|
||||
}
|
||||
SECTION("to_char16_t") {
|
||||
char16_t utf8_to_char16 = lua["utf8"];
|
||||
char16_t utf16_to_char16 = lua["utf16"];
|
||||
char16_t utf32_to_char16 = lua["utf32"];
|
||||
|
@ -128,6 +134,18 @@ TEST_CASE("stack/strings", "test that strings can be roundtripped") {
|
|||
REQUIRE(utf32_to_char16 == utf16str[0]);
|
||||
REQUIRE(wide_to_char16 == utf16str[0]);
|
||||
}
|
||||
SECTION("to_char") {
|
||||
char utf8_to_char = lua["utf8"].get<char>();
|
||||
char utf16_to_char = lua["utf16"].get<char>();
|
||||
char utf32_to_char = lua["utf32"].get<char>();
|
||||
char wide_to_char = lua["wide"].get<char>();
|
||||
|
||||
REQUIRE(utf8_to_char == utf8str[0]);
|
||||
REQUIRE(utf16_to_char == utf8str[0]);
|
||||
REQUIRE(utf32_to_char == utf8str[0]);
|
||||
REQUIRE(wide_to_char == utf8str[0]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("detail/demangling", "test some basic demangling cases") {
|
||||
std::string teststr = sol::detail::short_demangle<test>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user