Ownership for Fortran pointers

@hkvzjal I see. It seems it’s a little bit like this thread: Rank a compile time concept vs a run time concept?. In general as a guiding principle, we want to add strong compile time features, not “interpreted” runtime features. In this case it seems to me you want a special kind of smart pointer, that in C++ would decide at runtime if it is std::unique_ptr or just a raw pointer (or a weak pointer). So in C++ I would implement a custom smart pointer for that. I am still not sure this is a good design though.

Another way to look at this is from performance perspective: if this kind of code doesn’t need to be the absolute best performance, then even using the reference counted pointers would be ok.