PDA

View Full Version : Evaluate an expression over an STL container



bleair
02-22-2008, 03:10 PM
I would like to use the evaluate tool to iterate through one of my stl
containers. The documentation for the evaluate tool only shows simple examples
where arrays and simple integer iterators are used.

Is it possible to iterate through an stl container? Is it even possible to declare an STL iterator type variable in the evaluate expression box?

For example, let's say I have the following program code:

class MyClass {
public:
bool m_flag;
};

std::deque <MyClass> g_mySet;

Now, I'd like to evaluate a little expression snippet that iterates
through mySet.
--------------------------
int numberSet;
std::deque <MyClass>::iterator myiter;

numberSet = 0;
for (myiter = g_mySet.begin (); myiter != g_mySet.end (); myiter++)
{
if ((*myiter).m_flag)
numberSet++;
}
numberSet++;


I get errors when I try to do this, but I may not be using the correct magic
syntax needed for the Evaluate Expression window. Is this possible?

PeterT-RogueWave
03-06-2008, 12:18 PM
At this point we don't have support for deque or iterators in the STL transformations. We are looking at improving this support, but are not able to make any guarantees. Of course, if you search our documentation, you will find that we have pointers on how to write your own type transforms, and it has always been our hope that users would chip in useful transforms they have come up with. Hint, hint...