[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Using std::set but need to change an element

FYI: It turns out that the 'bullet' physics engine (as used by - for
example - the Blender game engine) is based on the technology in that

Gianfranco Berardi wrote:
steve wrote:
Gianfranco Berardi wrote:

I found some code at http://www.gphysics.com to do "quick and simple" physics, but I find that the code was written in VC++. I've managed to get it to mostly compile in g++ 4.0.4, but I'm having trouble with the use of std::set.

Yeah - so did I.

I never did figure out what the problem was with std::set
so I just dumped the code that used std::set and wrote a
really crude replacement (*REALLY* crude!).

Actually, I figured it out:

    for (ArbIter arb = arbiters.begin(); arb != arbiters.end(); ++arb)
        // Erase key from set, modify it, then add it again.
        Arbiter newArb = *arb;

At the very least, the above code compiles. Whether or not there will be run-time errors, I'm not sure yet. I didn't even think about getting the original program to run, but maybe that would assure that it still works correctly. Most likely, the above code would run in VC++, too.

I will look into your project, though. As for collaboration on a 3D version, I'll have to decline as I am quite busy these days.