|
|
std::map clear throws an exception
Hi ,
When I am trying to using map::clear to clear my map , I am getting
an exception .
map<long, CMyClass> myMap;
myMap.clear() ; // Clear the map before doing anything new .
Any help would be appreciated .
Thanks .
Sujay
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
ghosh.sujay (1)
|
2/26/2005 12:56:31 PM |
|
ghosh.sujay@gmail.com writes:
> Hi ,
>
> When I am trying to using map::clear to clear my map , I am getting
> an exception .
>
> map<long, CMyClass> myMap;
>
> myMap.clear() ; // Clear the map before doing anything new .
>
> Any help would be appreciated .
Some possible explanations:
1. The destructor of CMyClass is throwing (that's a no-no).
2. Your code has a bug somewhere, you have previously corrupted your
program state, and you're working on an OS like Windows, where
symptoms of coding errors like segfaults are turned into something
that can be mistaken for a C++ exception.
IMO, your best bet is careful tracing with a good debugger.
Good luck!
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
David
|
2/26/2005 3:23:42 PM
|
|
|
1 Replies
725 Views
(page loaded in 0.604 seconds)
Similiar Articles: std::map clear throws an exception - comp.lang.c++.moderated ...Hi , When I am trying to using map::clear to clear my map , I am getting an exception . map myMap; myMap.clear() ; // Clear the m... std::exception::what() - comp.lang.c++.moderatedstd::map clear throws an exception - comp.lang.c++.moderated ... Hi , When I am trying to using map::clear to clear my map , I am getting an exception . map myMap; myMap ... catching std::exception by value - comp.lang.c++.moderated ...std::map clear throws an exception - comp.lang.c++.moderated ... I need to write a ... ... Also note that, in general, a value like 0.151177 cannot ... std::map clear ... does vector::resize throw bad_alloc exception? - comp.lang.c++ ...std::map clear throws an exception - comp.lang.c++.moderated ... Why no std::back_insert_iterator::value_type? - comp.lang.c++ ... << endl; userResult.clear ... does ... std::map< MyString, MyString > comparison operator? - comp.lang ...std::map clear throws an exception - comp.lang.c++.moderated ... [ace-users] No overloaded ostream operator for ACE_Time_Value ... ACE ... exception? - comp.lang.c++ ... Unexpected exception - comp.dcom.sys.ciscostd::map clear throws an exception - comp.lang.c++.moderated ... Unexpected exception... - comp.dcom.sys.cisco std::map clear throws an exception - comp.lang.c++.moderated ... Why no std::back_insert_iterator::value_type? - comp.lang.c++ ...std::map clear throws an exception - comp.lang.c++.moderated ... Why no std::back_insert_iterator::value_type? - comp.lang.c++ ... << endl; userResult.clear ... does ... converting double to long - comp.lang.c... to do this conversion: > >long convert(double value); It's not exactly clear what ... to unsigned long conversion - comp ... converting double to long - comp.lang.c std ... Result of Exception in constructor and destructor !! - comp.lang ...If such a destructor throws, the second exception causes std::terminate to be called. ... std::map MyString, MyString > comparison operator? - comp.lang ... ... C++: PTHREAD_CANCEL_ASYNCHRONOUS and random crash - comp ...You can throw an exception from a destructor but it is very seldom a good idea ... in tr1::unordered_map - comp.lang ..... gnu_cxx::hash_map to std::tr1::unordered_map ... Answer : std::map: clear throws an exceptionstd::map: clear throws an exception - answer - Hi , When I am trying to using map::clear to clear my map , I am getting an exception . map<long, CMyClass> myMap ... std::map clear throws an exception - comp.lang.c++.moderated ...Hi , When I am trying to using map::clear to clear my map , I am getting an exception . map myMap; myMap.clear() ; // Clear the m... 7/23/2012 9:30:09 AM
|
|
|
|
|
|
|
|
|