libcellml icon indicating copy to clipboard operation
libcellml copied to clipboard

API: add methods to retrieve a vector of components, variables, etc.

Open agarny opened this issue 5 years ago • 0 comments

Not sure whether this issue has already been raised, so here goes just in case...

Right now, if we want to iterate through a component's variables, we need to do something like:

for (size_t i = 0; i < comp->variableCount(); ++i) {
    auto var = comp->variable(i);
    ...
}

while in C++11 and later, we would simply do something like:

for (const auto &var : comp->variables()) {
    ...
}

It would therefore be nice to update our API throughout to have methods like Component::variables() so that we can easily iterate through a list (aka vector) of items.

agarny avatar Sep 28 '20 20:09 agarny