When I run it I get:
…
max size: 4294967295
size: 56
t._indices[0] 206
max size: 4294967295
size: 56
t._indices[1] 212
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
I changed my code to:
_indices.insert(t._indices[0]);
_indices.insert(t._indices[2]);
_indices.insert(t._indices[1]);
It inserted 2 ok but still failed on 1. Any ideas? How should I go about
debugging this?
When I run it I get:
…
max size: 4294967295
size: 56
t._indices[0] 206
max size: 4294967295
size: 56
t._indices[1] 212
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
It inserted 2 ok but still failed on 1. Any ideas? How should I go
about
debugging this?
Smells like t._indices[1] is tried to be accessed but does not exist.
If this t._indices is a set such things can happen, as (afair) a set
is stored (or better - suggested to be stored) as a binary tree so
maybe you’re trying to access an empty leaf here (some please correct
me if I’m wrong). What exactly happens depends on the STL-
Implementation you’re using.
If you use sets or maps I would strongly recommend to use iterators
or the find function to access elements. I would only trust the
bracket-operator when using vectors.
For more precise explainations on that topic I would have a look at
comp.lang.c++ as already mentioned.