I have created an abstracted dictionary in fortran which might suit your needs.
See: https://github.com/zerothi/fdict
Basically it lets you do
type(dict) :: dic, dic2
dic = ('KEY'.kv.1)
dic = dic //('next'.kv. (/3.,5.,6./))
dic = dic //('string'.kv.'Hello world')
dic2 = ('string2'.kv.'Test')
dic = dic // ('dic2'.kvp.dic2)
Where you can save all intrinsic types and it can easily be extended to contain other data-types, it defaults to initially contain itself as another value. (the last line retains a dictionary as a pointer)
It does .kv. == key : value
designation which is a deep copy, and
.kvp. == key : pointer
which is a reference copy.
In this way you can store huge data without having to duplicate data and retrieve the pointer at some later point.
To elaborate on the idea, all data is stored as address pointers using a transfer
call from a derived type containing the data pointer. In this way you trick the compiler to hand you the address of the fortran derived type, but forces you to retrieve it in the exact same manner.
By .kv.
a pointer of the data-type is allocated and subsequently pointed to by the data-container, then afterwards the allocated pointer is nullify
ied and lost thus forcing the user to know what they are doing (there is no garbage-collector in it ;) ).
By .kvp.
the pointer is directly saved without duplicating any memory.
The nice thing is that it is fortran90 compliant.