#### Archived

This topic is now archived and is closed to further replies.

# Debug Assertion Failed std::vector push_back

This topic is 5359 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I''m having a problem attempting to push an instance of one of my classes onto the end of a vector. The following is the code that causes the problem:
//theTextPanels is declared like: vector <TBTextPanel> theTextPanels;

TBTextPanel textControl;
theTextPanels.push_back(textControl);

When the push_back is called the following error is shown: Debug Assertion Failed File: dbgheap.c Line: 1044 Expression: crtIsValidHeapPointer(pUserData) I''ve stripped the TBTextPanel class down so all it contains is its constructor and destructor. The strange thing is that I have another class that I have done the same to but when using push_back on that it works fine. Also if I make the TBTextPanel inherit from TBControl and then add it to a vector of TBControls it doesn''t throw up an error. But still does if I add it to a vector of TBTextPanels. All references to this error I have seen while searching seem to relate to deleting pointers etc. If anyone could help I would be grateful. Thanks.

##### Share on other sites
What''s the copy constructor and destructor look like for TBTextPanel?

##### Share on other sites
I''m using the default copy constructor/destructor i.e. I haven''t defined one.

It seems strange that I would need to since I don''t have member variables in the TBTextPanel class. Also the program dies before the textControl instance of TBTextPanel is destroyed.

##### Share on other sites
By any chance does your code involve DLLs in any way?

##### Share on other sites
If you''re using visual studio, you might try a "rebuild all" just in case. Occasionally it has trouble compiling when only parts of your code need recompiling.

"Unfortunatly, when I sent the email, instead of writing "Best Regards" I ended up writing "Best Retards." - boolean

##### Share on other sites
Hah, doing a rebuild all fixed the problem, thats all it took for a problem thats lasted two days .

Thanks all.

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 11
• 16
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633004
• Total Posts
3009851
• ### Who's Online (See full list)

There are no registered users currently online

×