From 1e823da3f4fc1636c2adbc73dd74fe53a3bb2108 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Fri, 7 Sep 2018 10:23:56 +0200 Subject: [PATCH] Add bound check --- src/utils/Array.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/Array.hpp b/src/utils/Array.hpp index 0a98046aa..497c0c590 100644 --- a/src/utils/Array.hpp +++ b/src/utils/Array.hpp @@ -1,6 +1,7 @@ #ifndef ARRAY_HPP #define ARRAY_HPP +#include <PastisAssert.hpp> #include <Kokkos_Core.hpp> template <typename DataType> @@ -22,6 +23,7 @@ class Array KOKKOS_INLINE_FUNCTION DataType& operator[](const size_t& i) const { + Assert(i<m_values.extent(0)); return m_values[i]; } @@ -64,6 +66,9 @@ class Array this->operator=(array); } + KOKKOS_INLINE_FUNCTION + Array(Array&&) = default; + KOKKOS_INLINE_FUNCTION Array(const Array&) = default; -- GitLab