From b5748d042386e44a7b32efdfb5636132ae8c2b4c Mon Sep 17 00:00:00 2001 From: romintomasetti Date: Wed, 28 Aug 2024 15:19:11 +0000 Subject: [PATCH] core(view): implications of WithoutInitializing --- docs/source/ProgrammingGuide/View.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/source/ProgrammingGuide/View.rst b/docs/source/ProgrammingGuide/View.rst index 9838773e9..cf5a9e9ce 100644 --- a/docs/source/ProgrammingGuide/View.rst +++ b/docs/source/ProgrammingGuide/View.rst @@ -461,6 +461,15 @@ in a way that reflects how first-touch affinity to threads is desired. Typically it is sufficient to use the parallel iteration index as the index of the location in the view to write to. +.. warning:: + + :cppkokkos:`WithoutInitialization` implies that the destructor of each element of the :cppkokkos:`View` **will not be called**. + For instance, if you need the destructor of your :code:`MyObjectWithDestructor` be called for each element of your :cppkokkos:`View`, + you **should not use** :cppkokkos:`WithoutInitialization`. + + The reason for that is, since `Kokkos` did not initialize the memory, it cannot know onto which elements of the :cppkokkos:`View` calling the destructor + of the :code:`value_type` is valid. + 6.4.3 Deep copy and HostMirror ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~