how can i loop over a vector without crashing
<p>i have this vector da.GameObjects</p>

<p>i am updating and removing data to this from another thread, when i try to iterate over it it crashes.</p>

<p>i know i need to use a mutex but when i do it causes locks and delays (lag) in my iteration for some reason.</p>

<p>Is there any technique or trick i can use to read it but not crash? (even if it's not synchronized?</p>

<pre><code>for (auto  &amp; ent : da.GameObjects)
{       
    Location l;
    l.X = ent.X;
    l.Y = ent.Y;

    if (ent.Type == EntityType::Monster)
    {
        CastSpell(1, 5, ent.Serial);
    }
}
</code></pre>

<p>There must be a way to "try" to loop thru it without crashing? a for loop won't work either</p>
