I have some matrix type that can either be real or complex:
type t_mat
logical :: is_real
real :: data_r(:,:)
complex :: data_c(:,:)
end type
and I would like to overload the =-operator as well as the (i,j) operator, so that I could conveniently say:
type(t_mat) :: a
...
a(2,3) = 3
I know in C++ it is possible to overload the subscript operator. Does Fortran allow for something similar?