First of all let me apologize by my english.
I've googled a lot about my problem, but I had not find anything conclusive.
I have the following piece of code:
which give me the error indicated in comment.
vector < map < int , char * > > bank;
bank . reserve ( 10 );
if ( bank [ 0 ] [ 0 ] == "a" ) //Memory access error (Access violation at address #blabla)
So, to test, I included the following line before "if", and the error changes to that line
Finally, the following inserted in place of the line above, works.
bank [ 0 ] [ 0 ] = "b"; //Same error
Code: ( text )
But this is hardly an option to me. Mainly because I need, most of times, to test the variable "bank" (even the NULL address existence, which tells me that new item insertion is ok) before I can decide what to do. Beside that, that association grows interactively.
map < int , char * > data;
data [ 0 ] = "a";
bank . push_back ( data );
As I can see, it seems a problem with map allocation.
So, my exactly question is how can I use this type of association ( vector < map < type1 , type2 > > ) without get into Mermory access violation errors? Is there a way to previously initialize that association in a manner that allow me to insert new element just doing
Code: ( text )
even after the limits previously defined (growing the association)?
bank [ i ] [ j ] = "some"
Please excuse me if this is trivial, but I'm new to STL.
I appreciate any helps.
Thanx in advance.