.. highlight:: c .. _arr_view_memory: View memory management ------------------------ View classes contains a reference counting system to the memory block they view (like a std::shared_ptr, but more sophisticated to properly interface to Python numpy). This guarantees that memory will not be dellocated before the destruction of the view. The memory block will be dellocated when its array and all array_view pointing to it or to a portion of it will be destroyed, and only at that moment. Example:: array *p = new array (2,3); // create an array p array_view B = *p; // making a view delete p; // p is gone... B(0,0) = 314; cout<) the reference counting is again incremented, and the memory guarantee holds. * Explicit construction of weak views is intentionally not documented here. It is designed to be (almost) an implementation detail. * The () operator returns a weak view `on a fully compliant C++11 compiler` (in particular, `rvalue reference for *this` must be implemented) allowing therefore for better performance on such compiler, in some loops. Older supported compiler will therefore generate code with lower performances. * It is however necessary for the advanced user to know about this implementation detail, because in some convolved cases, the memory guarantee may not hold. Example :: TO BE WRITTEN