我有一個用戶定義類型vector
。在另一種類型中,我有一個可分配的向量數組。我想要一個指向這個可分配數組的單個向量的指針。所以,我想我會做到這一點:我可以有一個指向可分配數組組件中的項目的指針嗎?
type another_type
type(vector),allocatable,target::my_vectors(:)
end type
和
type(vector),pointer::pointed_vec
但是當我編譯,編譯器會抱怨說:
This attribute specification is not valid for a component definition statement.
我可以從指針到單個項目一個可分配的數組?可能嗎?
好點,但那只是我沒有正確記住我的代碼。我確實有一個數組聲明,而不是一個標量...... – 2010-10-18 06:08:44
另外我錯讀了你的allocatable也在類型定義中。不確定大編輯禮儀,所以增加了新的答案。 – Deditos 2010-10-18 10:35:24