Use std::unordered_map<> in wxIdManager code
Replace a wx hash map with the standard container.
This commit is contained in:
parent
7fb3ce78d4
commit
3de3a92a9c
1 changed files with 6 additions and 3 deletions
|
|
@ -18,9 +18,12 @@
|
|||
#include "wx/intl.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/windowid.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
using wxWindowIDHashMap = std::unordered_map<wxWindowID, long>;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
|
@ -46,7 +49,7 @@ wxUint8 gs_autoIdsRefCount[wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 1] = { 0 };
|
|||
// freed. The cell storing the count for an ID is freed only when its count
|
||||
// gets to zero (not when it goes below ID_COUNTTOOLARGE, so as to avoid
|
||||
// degenerate cases)
|
||||
wxLongToLongHashMap *gs_autoIdsLargeRefCount = nullptr;
|
||||
wxWindowIDHashMap *gs_autoIdsLargeRefCount = nullptr;
|
||||
|
||||
// this is an optimization used until we wrap around wxID_AUTO_HIGHEST: if this
|
||||
// value is < wxID_AUTO_HIGHEST we know that we haven't wrapped yet and so can
|
||||
|
|
@ -106,7 +109,7 @@ void IncIdRefCount(wxWindowID winid)
|
|||
{
|
||||
// we need to allocate a cell, and maybe the hash map itself
|
||||
if (!gs_autoIdsLargeRefCount)
|
||||
gs_autoIdsLargeRefCount = new wxLongToLongHashMap;
|
||||
gs_autoIdsLargeRefCount = new wxWindowIDHashMap;
|
||||
(*gs_autoIdsLargeRefCount)[winid] = ID_COUNTTOOLARGE-1;
|
||||
|
||||
gs_autoIdsRefCount[winid] = ID_COUNTTOOLARGE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue