currently I am trying to solve two problems when working with iterators.
1
When using something like
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
{
phaseModel& phase = iter();
.
.
.
}
is it possible to get the actual position/index of iterator "iter" (which pointer is the iterator refering to at the moment)? I know that for the vector class I could use something like described in the following link
What is the most effective way to get the index of an iterator of an std::vector?
but unfortunately the class "PtrDictionary" which I have to use does not offer a method "begin()". Furthermore "PtrDictionary" is basically of type "intrusive doubly linked list".
2
Old Question:
If I define a dictionary like
const dictionary& subDict_Droplets; subDict_Droplets = properties.subDict("currentValue");
Can I create an iterator for the dictionary, set this iterator to a specific position of the dictionary (the position I would get from the first iterator if possible -> see code snippet 1) and get the content of the dictionary at that position?
I have read the following thread
how to get iterator to a particular position of a vector
but again class "dictionary" does not have any method "begin()".
Edit/New: I have used now a list (which is of "type" vector) like
const List<dimensionedScalar> List_Droplets;
List_Droplets = properties.subDict("currentValue");
The elements of the vector should be accessable like an array as far as I have read :).
However, the type of the object phases_
which is of type PtrDictionary<phaseModel>
(parents: DictionaryBase< IDLListType, T >
and parent of this: IDLListType
) which is mentioned in question 1
I can t change.
Any hints, ideas or code solutions are welcome :)
greetings streight