I've been working on resource management again and found a problem related to debug new and std::map.
This code:
Fails on the bolded line if you define new as debug new prior to including std::map. The placement form of new works fine with the normal new but fails on the debug new that tracks allocations and de-allocations.Code:_Nodeptr _Buynode(_Nodeptr _Larg, _Nodeptr _Parg, _Nodeptr _Rarg, const value_type& _Val, char _Carg) { // allocate a node with pointers, value, and color _Nodeptr _Wherenode = this->_Alnod.allocate(1); _TRY_BEGIN new (_Wherenode) _Node(_Larg, _Parg, _Rarg, _Val, _Carg); _CATCH_ALL this->_Alnod.deallocate(_Wherenode, 1); _RERAISE; _CATCH_END return (_Wherenode); }
Nice eh.
The sample for std::map in the help docs for MSVS will not compile if you are defining debug new prior to using std::map.



LinkBack URL
About LinkBacks



CornedBee