Re: Reference to derived type element by index?



Rob Crain wrote:

Hi Gary - thanks for your reply. I think my initial explanation may have been unclear, as this is not the solution to my problem. The problem reduces to the following: I don't know explicitly which variable (I incorrectly referred to this variable as an element previously, hence the confusion) I want to update, so I can't say

circle%radius = <something>

All I have is an index that tells me I need to update the i^th variable within the derived type. So say I need to update circle%z, the index would have value 4. But I know that I can't do

By i'th variable, are you saying the i'th component? No you can't alias an index with the formally defined components and have value 1 refer to radius and value 2 refer to x. You could use select case to make that choice based upon the index. Still not sure I understand fully tho.

<snip>
--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows it can't be done.

-- Henry Ford
.



Relevant Pages

  • Re: The linf project
    ... language and to be honest with you, ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: IRibbonExtensibility and custom ribbon image
    ... Please refer to my reply to Sven which clarifies my question a little ... callback function is not fired and how to set a custom image for ribbon ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.office.developer.com.add_ins)
  • RE: MSBuild generates different files than Visual Studio 2005 ?
    ... however looking at the issue you refer me to ... referenced assemblies to the output folder. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vsnet.general)
  • Re: Learning things first hand
    ... refer to the _so-called_ 'loving' relationships of today. ... this because it refers to _any_ homosexual act. ... I do not support gross perversion. ... to worship in the temple. ...
    (soc.religion.christian)
  • Re: Planning the Hyerdahl Sexagennial - July 8, 2008
    ... According to pop feminists, ... refer to her "patriarchal poppa" and then claim that she does not hate her ... accuse you of copyright infringement, ... claim that "all doctors" know something (with absolutely no factual support ...
    (soc.men)