mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-17 01:16:02 +01:00
Update array.hpp (#3769)
* Update array.hpp Problem:Calling back on an empty container causes undefined behavior. Solution:Check with the function empty() * Create xqcool.mq Adds relicensing grant
This commit is contained in:
@@ -100,8 +100,9 @@ template <typename T, int ID = 0> class array_t
|
||||
|
||||
inline void erase (size_type index_)
|
||||
{
|
||||
if (_items.back ())
|
||||
((item_t *) _items.back ())->set_array_index ((int) index_);
|
||||
if (_items.empty ())
|
||||
return;
|
||||
((item_t *) _items.back ())->set_array_index ((int) index_);
|
||||
_items[index_] = _items.back ();
|
||||
_items.pop_back ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user