dont include archive.hpp, use template function

This commit is contained in:
Christopher Lackner 2023-09-05 13:23:37 +02:00
parent b4dee312a4
commit d4c8a94abb
3 changed files with 7 additions and 9 deletions

View File

@ -8,7 +8,6 @@
/**************************************************************************/ /**************************************************************************/
#include <core/array.hpp> #include <core/array.hpp>
#include <core/archive.hpp>
namespace netgen namespace netgen
{ {
@ -423,8 +422,9 @@ namespace netgen
} }
// Only provide this function if T is archivable // Only provide this function if T is archivable
template<typename T2=T> template<typename ARCHIVE>
auto DoArchive(ngcore::Archive& archive) -> typename std::enable_if<ngcore::is_archivable<T2>, void>::type auto DoArchive(ARCHIVE& archive)
-> typename std::enable_if_t<ARCHIVE::template is_archivable<T>, void>
{ {
if(archive.Output()) if(archive.Output())
archive << size; archive << size;

View File

@ -7,7 +7,6 @@
/* Date: 20. Jul. 02 */ /* Date: 20. Jul. 02 */
/* *************************************************************************/ /* *************************************************************************/
#include <core/archive.hpp>
#include <core/array.hpp> #include <core/array.hpp>
#include <general/ngarray.hpp> #include <general/ngarray.hpp>
@ -72,7 +71,8 @@ namespace netgen
operator const T* () const { return x; } operator const T* () const { return x; }
void DoArchive(Archive& archive) template<typename ARCHIVE>
void DoArchive(ARCHIVE& archive)
{ {
for(int i=0; i<D; i++) for(int i=0; i<D; i++)
archive & x[i]; archive & x[i];

View File

@ -7,11 +7,8 @@
/* Date: 01. Oct. 94 */ /* Date: 01. Oct. 94 */
/* *************************************************************************/ /* *************************************************************************/
#include <core/archive.hpp>
namespace netgen namespace netgen
{ {
using namespace ngcore;
template <typename T> template <typename T>
class TFlatVector class TFlatVector
@ -142,7 +139,8 @@ public:
~Vector () ~Vector ()
{ if (ownmem) delete [] data; } { if (ownmem) delete [] data; }
virtual void DoArchive(Archive& ar) template<typename ARCHIVE>
void DoArchive(ARCHIVE& ar)
{ {
auto size = s; auto size = s;
ar & ownmem & size; ar & ownmem & size;