sol2
sol2 copied to clipboard
Conversion of proxy_base to std::string_view is broken
trafficstars
#define SOL_ALL_SAFETIES_ON 1
#define SOL_PRINT_ERRORS 1
#define SOL_EXCEPTIONS_SAFE_PROPAGATION 1
#include <sol/sol.hpp>
int main() {
sol::state lua;
lua.open_libraries();
sol::table t = lua.script("return {'hello'}");
std::string a = t[1]; // Works
std::string_view b = t[1]; // Doesn't compile
return 0;
}
I see that proxy_base has an overload to cast into string-like objects, but this candidate fails due to this error:
proxy_base.hpp(53, 3): Candidate template ignored: requirement 'all<std::integral_constant<bool, false>, sol::is_proxy_primitive<std::basic_string_view<char, std::char_traits<char>>>>::value' was not satisfied [with T = std::basic_string_view<char>]
Walkaround: t[1].get<std::string_view>() or t.get<std::string_view>(1)