mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
vetting for C++17
This commit is contained in:
parent
0744cc4e4a
commit
2d65f6caa5
@ -263,7 +263,7 @@ namespace sol {
|
||||
|
||||
template <typename N, typename... Fxs>
|
||||
void add(lua_State* L, N&& n, constructor_wrapper<Fxs...> c) {
|
||||
object o(L, in_place<detail::tagged<T, constructor_wrapper<Fxs...>>>, std::move(c));
|
||||
object o(L, in_place_type<detail::tagged<T, constructor_wrapper<Fxs...>>>, std::move(c));
|
||||
if (std::is_same<meta::unqualified_t<N>, call_construction>::value) {
|
||||
callconstructfunc = std::move(o);
|
||||
return;
|
||||
@ -273,7 +273,7 @@ namespace sol {
|
||||
|
||||
template <typename N, typename... Lists>
|
||||
void add(lua_State* L, N&& n, constructor_list<Lists...> c) {
|
||||
object o(L, in_place<detail::tagged<T, constructor_list<Lists...>>>, std::move(c));
|
||||
object o(L, in_place_type<detail::tagged<T, constructor_list<Lists...>>>, std::move(c));
|
||||
if (std::is_same<meta::unqualified_t<N>, call_construction>::value) {
|
||||
callconstructfunc = std::move(o);
|
||||
return;
|
||||
@ -283,7 +283,7 @@ namespace sol {
|
||||
|
||||
template <typename N>
|
||||
void add(lua_State* L, N&& n, destructor_wrapper<void> c) {
|
||||
object o(L, in_place<detail::tagged<T, destructor_wrapper<void>>>, std::move(c));
|
||||
object o(L, in_place_type<detail::tagged<T, destructor_wrapper<void>>>, std::move(c));
|
||||
if (std::is_same<meta::unqualified_t<N>, call_construction>::value) {
|
||||
callconstructfunc = std::move(o);
|
||||
return;
|
||||
@ -293,7 +293,7 @@ namespace sol {
|
||||
|
||||
template <typename N, typename Fx>
|
||||
void add(lua_State* L, N&& n, destructor_wrapper<Fx> c) {
|
||||
object o(L, in_place<detail::tagged<T, destructor_wrapper<Fx>>>, std::move(c));
|
||||
object o(L, in_place_type<detail::tagged<T, destructor_wrapper<Fx>>>, std::move(c));
|
||||
if (std::is_same<meta::unqualified_t<N>, call_construction>::value) {
|
||||
callconstructfunc = std::move(o);
|
||||
return;
|
||||
|
@ -213,12 +213,12 @@ namespace sol {
|
||||
template <typename Arg>
|
||||
inline std::string make_string(Arg&& arg) {
|
||||
string_detail::string_shim s = make_shim(arg);
|
||||
return std::string(s.c_str(), s.size());
|
||||
return std::string(s.data(), s.size());
|
||||
}
|
||||
|
||||
template <typename N>
|
||||
inline luaL_Reg make_reg(N&& n, lua_CFunction f) {
|
||||
luaL_Reg l{ make_shim(std::forward<N>(n)).c_str(), f };
|
||||
luaL_Reg l{ make_shim(std::forward<N>(n)).data(), f };
|
||||
return l;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ TEST_CASE("object/string-pushers", "test some basic string pushers with in_place
|
||||
sol::state lua;
|
||||
|
||||
sol::object ocs(lua, sol::in_place, "bark\0bark", 9);
|
||||
sol::object os(lua, sol::in_place<std::string>, std::string("bark\0bark", 9), 8);
|
||||
sol::object os(lua, sol::in_place_type<std::string>, std::string("bark\0bark", 9), 8);
|
||||
bool test1 = os.as<std::string>() == std::string("bark\0bar", 8);
|
||||
bool test2 = ocs.as<std::string>() == std::string("bark\0bark", 9);
|
||||
REQUIRE(test1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user