mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 21:30:35 +05:00
std::move in register_archive
This commit is contained in:
parent
62d2e4fba5
commit
8f762bc33d
@ -77,7 +77,8 @@ namespace ngcore
|
|||||||
{
|
{
|
||||||
template <class T, class Tuple, size_t... Is>
|
template <class T, class Tuple, size_t... Is>
|
||||||
T* construct_from_tuple(Tuple&& tuple, std::index_sequence<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>
|
template <class T, class Tuple>
|
||||||
|
@ -34,6 +34,8 @@ namespace ngcore {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// now using has_shared_from_this2 in archive.hpp
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct has_shared_from_this
|
struct has_shared_from_this
|
||||||
{
|
{
|
||||||
@ -42,6 +44,7 @@ namespace ngcore {
|
|||||||
typedef decltype( check<T>(sizeof(char)) ) type;
|
typedef decltype( check<T>(sizeof(char)) ) type;
|
||||||
static constexpr type value = type();
|
static constexpr type value = type();
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
#endif // NETGEN_PYTHON
|
#endif // NETGEN_PYTHON
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +62,7 @@ namespace ngcore {
|
|||||||
{
|
{
|
||||||
detail::TCargs<T> args;
|
detail::TCargs<T> args;
|
||||||
ar &args;
|
ar &args;
|
||||||
auto nT = detail::constructIfPossible<T>(args);
|
auto nT = detail::constructIfPossible<T>(std::move(args));
|
||||||
return typeid(T) == ti ? nT
|
return typeid(T) == ti ? nT
|
||||||
: Archive::Caster<T, Bases>::tryUpcast(ti, nT);
|
: Archive::Caster<T, Bases>::tryUpcast(ti, nT);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user