Added the GDB trick to visualize the components of a vector

(but it still doesn't work with EO objects, though???)
This commit is contained in:
evomarc 2007-12-08 15:05:51 +00:00
commit b8da2db21f

View file

@ -292,16 +292,20 @@ method will take more time for vectors than for linked lists, while on
the opposite, the operator[] accessor will be faster for vectors. But both
will work anyway.
<p><b><font color="#FF0000">STL: </font><font color="#000099">Drawbacks</font></b>
<br>The main drawback I see in using STL is that it makes it almost
<b><font color="#FF6600">impossible
<br>The main drawback I see in using STL is that it makes it
<b><font color="#FF6600">difficult
to use a debugger </font></b>normally: whereas access to data is made simple
to the programmer, data structures are actually so complex, and debuggers
so willing to display everything that you get lines of template instantiation
when asking your debugger what is inside some container! For instance I
when asking your debugger what is inside some container! <br>
However, here is a trick (thanks to Arnaud Quirin!) to actually print what is inside an STL vector with gdb (but it doesn't really work with complex structures like EO genotypes :-( :<br/>
<b><tt>(gdb) <font color="#993300">print (*(&amp;v))[i]<br/>
$1 = (const double &amp;) @0x934cad0: 0.69543264131061733<br/></font></tt></b>
<!-- For instance I
could never visualize some
<b><tt><font color="#993300">v[i]</font></tt></b>
with <b><tt><font color="#FF6600">gbd</font></tt></b>, <b><tt><font color="#993300">v</font></tt></b>
being an STL vector!
being an STL vector! -->
<p>
<hr WIDTH="100%">
<br><a NAME="random"></a><b><font color="#000099"><font size=+1>Random