85 lines
3.6 KiB
MQL5
85 lines
3.6 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Main.mqh |
|
|
//| Copyright 2026, Niquel Mendoza. |
|
|
//| https://www.mql5.com/ |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2026, Niquel Mendoza."
|
|
#property link "https://www.mql5.com/"
|
|
#property strict
|
|
|
|
|
|
#ifndef FASTCOLLECTIONSBYLEO_COLHASH_HASHSET_MAIN_MQH
|
|
#define FASTCOLLECTIONSBYLEO_COLHASH_HASHSET_MAIN_MQH
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
#include "..\\HashBases\\Main.mqh"
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
#define CHashSetFast(k) TSN::CHashSetFastInternal<k, TSN::CGenericHash_##k>
|
|
#define CHashSetFastIterator(k) TSN::CHashSetFastIteratorInt<k, TSN::CGenericHash_##k>
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
namespace TSN
|
|
{
|
|
template <typename TKey, typename TBase>
|
|
struct CHashSetFastIteratorInt;
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
namespace TSN
|
|
{
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
template <typename TKey>
|
|
struct CHashSetFastInternalPar
|
|
{
|
|
TKey key;
|
|
ulong hash;
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
template <typename TKey, typename TBase>
|
|
class CHashSetFastInternal : public CFastHashTableBase<CHashSetFastInternalPar<TKey>, TKey, TBase>
|
|
{
|
|
public:
|
|
CHashSetFastInternal(int initial_size = 128) { Init(initial_size); }
|
|
~CHashSetFastInternal(void) {}
|
|
|
|
//---
|
|
CHashSetFastIteratorInt<TKey, TBase> BeginIteration();
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
template <typename TKey, typename TBase>
|
|
CHashSetFastIteratorInt<TKey, TBase> CHashSetFastInternal::BeginIteration()
|
|
{
|
|
return CHashSetFastIteratorInt<TKey, TBase>(&this);
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
template <typename TKey, typename TBase>
|
|
struct CHashSetFastIteratorInt : public CFastHashTableIteratorBase<CHashSetFastInternal<TKey, TBase>, TKey>
|
|
{
|
|
CHashSetFastIteratorInt(CHashSetFastInternal<TKey, TBase>* ptr)
|
|
: CFastHashTableIteratorBase<CHashSetFastInternal<TKey, TBase>, TKey>(ptr)
|
|
{
|
|
}
|
|
};
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
#endif // FASTCOLLECTIONSBYLEO_COLHASH_HASHSET_MAIN_MQH
|