[Solved] Qt containers memory handling
-
Hi folks,
during our project we faced that we must know whether was the last operation on the given container successfull or not? I tried to found some article whitout any result.
Is there any official way to check the result of the:- adding of element
- resize
- ...etc
Regards,
Norbert -
Hi,
I think it's safe to assume that those functions will only fail if you run out of memory, which will give you a std::bad_alloc exception. You can catch that exception.
-
That's not a safe bet in an exception populated program. Although Qt is itself exception neutral its exception handling in user code is lacking to some degree. It "works" in most cases if you're careful enough though.
The topic is described in some details "here":http://qt-project.org/doc/qt-5/exceptionsafety.html