FastCollectionsByLeo/Src/ColHash/HashSet/Main.mqh

85 lines
3.6 KiB
MQL5
Raw Permalink Normal View History

2026-07-19 08:34:18 -05:00
//+------------------------------------------------------------------+
//| Main.mqh |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/"
#property strict
2026-07-21 11:09:28 -05:00
#ifndef FASTCOLLECTIONSBYLEO_COLHASH_HASHSET_MAIN_MQH
#define FASTCOLLECTIONSBYLEO_COLHASH_HASHSET_MAIN_MQH
2026-07-19 08:34:18 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#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)
{
}
};
}
//+------------------------------------------------------------------+
2026-07-21 11:09:28 -05:00
#endif // FASTCOLLECTIONSBYLEO_COLHASH_HASHSET_MAIN_MQH