use std::array in IVec (for 0-size handling)

This commit is contained in:
Joachim Schoeberl 2024-07-16 13:48:17 +02:00
parent 54d59cff1e
commit 7968ae4588
2 changed files with 4 additions and 3 deletions

View File

@ -46,7 +46,8 @@ namespace ngcore
class IVec class IVec
{ {
/// data /// data
T i[(N>0)?N:1]; // T i[(N>0)?N:1];
std::array<T,N> i;
public: public:
/// ///
@ -81,7 +82,7 @@ namespace ngcore
template <typename ARCHIVE> template <typename ARCHIVE>
void DoArchive(ARCHIVE& ar) void DoArchive(ARCHIVE& ar)
{ {
ar.Do(i, N); ar.Do(i.begin(), N);
} }
template <int N2, typename T2> template <int N2, typename T2>

View File

@ -164,7 +164,7 @@ void ng_init_mpi() {
imported_mpi4py = true; imported_mpi4py = true;
} }
PyObject* py_src = src.ptr(); PyObject* py_src = src.ptr();
auto type = Py_TYPE(py_src); [[maybe_unused]] auto type = Py_TYPE(py_src);
if (PyObject_TypeCheck(py_src, &PyMPIComm_Type)) { if (PyObject_TypeCheck(py_src, &PyMPIComm_Type)) {
dst = mpi2ng(*PyMPIComm_Get(py_src)); dst = mpi2ng(*PyMPIComm_Get(py_src));
return !PyErr_Occurred(); return !PyErr_Occurred();