Click here to Skip to main content
14,833,327 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Use inline member function to refer different levels of classes. Pin
CodingLover24-Jan-08 21:49
MemberCodingLover24-Jan-08 21:49 
GeneralRe: Use inline member function to refer different levels of classes. Pin
Cedric Moonen24-Jan-08 22:07
MemberCedric Moonen24-Jan-08 22:07 
GeneralRe: Use inline member function to refer different levels of classes. Pin
CodingLover24-Jan-08 22:22
MemberCodingLover24-Jan-08 22:22 
GeneralRe: Use inline member function to refer different levels of classes. Pin
Cedric Moonen24-Jan-08 22:32
MemberCedric Moonen24-Jan-08 22:32 
GeneralRe: Use inline member function to refer different levels of classes. Pin
CodingLover24-Jan-08 22:36
MemberCodingLover24-Jan-08 22:36 
GeneralRe: Use inline member function to refer different levels of classes. Pin
Cedric Moonen24-Jan-08 22:42
MemberCedric Moonen24-Jan-08 22:42 
GeneralRe: Use inline member function to refer different levels of classes. Pin
CodingLover24-Jan-08 22:47
MemberCodingLover24-Jan-08 22:47 
GeneralIssues with std::vector Pin
Waldermort24-Jan-08 19:00
MemberWaldermort24-Jan-08 19:00 
Is there some limitation on the vector template that I should know about?

I have a vector of 45,000 string pointers. It's a dictionary file Wink | ;) . Anyway, I need to iterate through these strings checking if more than one definition is present on the same line. Multiple definition are seperated with the '|' character, when I find one I create a new string and push it to the end of the vector. Simple enough you would think.

So, here is my code.

vector< LPENTRY >::iterator vIter = vEntries.begin();
    
    while ( vIter != vEntries.end() )
    {
        LPSTR szEng = strchr( (*vIter)->English, '|' );
    
        if ( szEng != NULL )
        {
            // Create a new entry
            LPENTRY pEntry = new ENTRY;
    
            // Copy the contents ( the struct arranges new memory and copies the strings )
            *pEntry = *vIter;
    
            // Copy the new English
            strcpy_s( pEntry->English, MAX_LINE_LENGTH, &szEng[ 1 ] );
    
            // Shorten the old string
            *szEng = 0x00;
    
            vEntries.push_back( pEntry );
        }
    
        vIter++;
    }


The problem is, when the vector grows to a size of 61447 and when pushing a new value to the end, it causes the iterator to become invalid ( pointing to 0xfeeefeee ). Hence when trying to increase it it triggers a breakpoint. Any ideas what is going wrong?

Waldermort

GeneralRe: Issues with std::vector Pin
Stephen Hewitt24-Jan-08 19:18
MemberStephen Hewitt24-Jan-08 19:18 
GeneralRe: Issues with std::vector Pin
Waldermort24-Jan-08 19:22
MemberWaldermort24-Jan-08 19:22 
GeneralShellExecute Pin
Paulraj G24-Jan-08 18:42
MemberPaulraj G24-Jan-08 18:42 
GeneralRe: ShellExecute Pin
Naveen24-Jan-08 18:44
MemberNaveen24-Jan-08 18:44 
GeneralRe: ShellExecute Pin
Paulraj G24-Jan-08 18:52
MemberPaulraj G24-Jan-08 18:52 
GeneralRe: ShellExecute Pin
Don Box24-Jan-08 18:58
MemberDon Box24-Jan-08 18:58 
GeneralRe: ShellExecute Pin
Paulraj G24-Jan-08 19:30
MemberPaulraj G24-Jan-08 19:30 
GeneralRe: ShellExecute Pin
Stephen Hewitt24-Jan-08 19:39
MemberStephen Hewitt24-Jan-08 19:39 
GeneralRe: ShellExecute Pin
Paulraj G24-Jan-08 19:43
MemberPaulraj G24-Jan-08 19:43 
GeneralRe: ShellExecute Pin
Naveen24-Jan-08 19:46
MemberNaveen24-Jan-08 19:46 
GeneralRe: ShellExecute Pin
Paulraj G24-Jan-08 23:53
MemberPaulraj G24-Jan-08 23:53 
GeneralRe: ShellExecute Pin
Naveen25-Jan-08 0:04
MemberNaveen25-Jan-08 0:04 
JokeRe: ShellExecute Pin
Rajesh R Subramanian25-Jan-08 0:13
professionalRajesh R Subramanian25-Jan-08 0:13 
GeneralRe: ShellExecute Pin
Stephen Hewitt24-Jan-08 19:48
MemberStephen Hewitt24-Jan-08 19:48 
QuestionRe: ShellExecute Pin
Rajesh R Subramanian24-Jan-08 19:56
professionalRajesh R Subramanian24-Jan-08 19:56 
GeneralRe: ShellExecute Pin
Paulraj G24-Jan-08 23:51
MemberPaulraj G24-Jan-08 23:51 
GeneralRe: ShellExecute Pin
Rajesh R Subramanian25-Jan-08 0:13
professionalRajesh R Subramanian25-Jan-08 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.