Hi all.
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:
vector < map < int , char * > > bank;
bank . reserve ( 10 );
if ( bank [ 0 ] [ 0 ] == "a" ) //Memory access error (Access violation at address #blabla)
which give me the error indicated in comment.
So, to test, I included the following line before "if", and the error changes to that line
bank [ 0 ] [ 0 ] = "b"; //Same error
Finally, the following inserted in place of the line above, works.
Code: ( text )
map < int , char * > data;
data [ 0 ] = "a";
bank . push_back ( data );
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.
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 )
bank [ i ] [ j ] = "some"
even after the limits previously defined (growing the association)?
Please excuse me if this is trivial, but I'm new to STL.
I appreciate any helps.
Thanx in advance.