# Ownership for Fortran pointers

**URL:** <https://fortran-lang.discourse.group/t/ownership-for-fortran-pointers/8084>\
**Category:** Language enhancement\
**Created:** [May 25, 2024, 4:19pm UTC](https://fortran-lang.discourse.group/t/ownership-for-fortran-pointers/8084 "2024-05-25T16:19:33Z")\
**Posts on this page:** 1\
**Showing post:** 55

<div class="post-metadata">

**Author:** ![gronki](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@gronki](https://fortran-lang.discourse.group/u/gronki)\
**Post date:** [November 21, 2024, 11:24am UTC](https://fortran-lang.discourse.group/t/ownership-for-fortran-pointers/8084/55 "2024-11-21T11:24:31Z")

</div>

```auto
type :: heavy_type
real a(11111,22222)
end type

class(*), allocatable :: a1
class(heavy_type), allocatable :: a2

allocate(heavy_type :: a1)

! task: move memory from a1 to a2 without a copy
! problem encountered whenever you want to build
! any kind of generic container without using pointers

```

And the type of the algorithm is not relevant, since pointer and allocatable cannot change their “flavor” (they cannot be converted between each other, as you mentioned), you either have to stick to one or another in the entire code (unless you want to make another copy).

---

_[View the full topic](https://fortran-lang.discourse.group/t/ownership-for-fortran-pointers/8084)._
