From e30dfdc101bba9f28aaef428bf5d11993feea92e Mon Sep 17 00:00:00 2001
From: Serhii Yaskovets <yaskovet@mpi-cbg.de>
Date: Wed, 14 Jun 2023 17:35:58 +0200
Subject: [PATCH] Fix grid_sm: copy constructor template not allowed

---
 src/Grid/grid_sm.hpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/Grid/grid_sm.hpp b/src/Grid/grid_sm.hpp
index 651608b2..234f6119 100644
--- a/src/Grid/grid_sm.hpp
+++ b/src/Grid/grid_sm.hpp
@@ -365,6 +365,25 @@ public:
 		}
 	}
 
+	/*! \brief copy constructor
+	 *
+	 * \param g grid info
+	 *
+	 * construct a grid from another grid. As a copy constructor can't be template,
+	 * the one above won't work for const grid_sm<N,S> & g, where S=T
+	 *
+	 */
+	__device__ __host__ inline grid_sm(const grid_sm<N,T> & g)
+	{
+		size_tot = g.size_tot;
+
+		for (size_t i = 0 ; i < N ; i++)
+		{
+			sz[i] = g.sz[i];
+			sz_s[i] = g.sz_s[i];
+		}
+	}
+
 	// Static element to calculate total size
 
 	inline size_t totalSize(const size_t sz)
-- 
GitLab