std::move in register_archive

This commit is contained in:
Joachim Schoeberl 2024-07-18 18:56:47 +02:00
parent 62d2e4fba5
commit 8f762bc33d
2 changed files with 6 additions and 2 deletions

View File

@ -77,7 +77,8 @@ namespace ngcore
{
template <class T, class Tuple, size_t... Is>
T* construct_from_tuple(Tuple&& tuple, std::index_sequence<Is...> ) {
return new T{std::get<Is>(std::forward<Tuple>(tuple))...};
// return new T{std::get<Is>(std::forward<Tuple>(tuple))...};
return new T{std::get<Is>(std::move(tuple))...};
}
template <class T, class Tuple>

View File

@ -34,6 +34,8 @@ namespace ngcore {
return *this;
}
/*
// now using has_shared_from_this2 in archive.hpp
template <typename T>
struct has_shared_from_this
{
@ -42,6 +44,7 @@ namespace ngcore {
typedef decltype( check<T>(sizeof(char)) ) type;
static constexpr type value = type();
};
*/
#endif // NETGEN_PYTHON
@ -59,7 +62,7 @@ namespace ngcore {
{
detail::TCargs<T> args;
ar &args;
auto nT = detail::constructIfPossible<T>(args);
auto nT = detail::constructIfPossible<T>(std::move(args));
return typeid(T) == ti ? nT
: Archive::Caster<T, Bases>::tryUpcast(ti, nT);
};