changed the position of the mmgr parameter in some constructors.
removed StdMmgr::getInstance() and initialized the default mmgr inside Mmgr::getDFL() to work around an issue related to c++ initialization order across translation units
This commit is contained in:
parent
b01cf731ca
commit
efc34cdd69
@ -106,12 +106,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Array (qse_size_t capacity = DEFAULT_CAPACITY): Mmged(QSE_NULL)
|
Array (Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
|
||||||
{
|
{
|
||||||
this->init_array (capacity);
|
this->init_array (DEFAULT_CAPACITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array (Mmgr* mmgr, qse_size_t capacity = DEFAULT_CAPACITY): Mmged(mmgr)
|
Array (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
|
||||||
{
|
{
|
||||||
this->init_array (capacity);
|
this->init_array (capacity);
|
||||||
}
|
}
|
||||||
|
@ -123,14 +123,14 @@ public:
|
|||||||
INVALID_INDEX = ParentType::INVALID_INDEX
|
INVALID_INDEX = ParentType::INVALID_INDEX
|
||||||
};
|
};
|
||||||
|
|
||||||
BinaryHeap (qse_size_t capacity = DEFAULT_CAPACITY): ParentType (QSE_NULL, capacity) {}
|
BinaryHeap (Mmgr* mmgr = QSE_NULL): ParentType(DEFAULT_CAPACITY, mmgr) {}
|
||||||
|
|
||||||
BinaryHeap (Mmgr* mmgr, qse_size_t capacity = DEFAULT_CAPACITY): ParentType (mmgr, capacity) {}
|
BinaryHeap (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
||||||
|
|
||||||
BinaryHeap (const SelfType& heap): ParentType (heap) {}
|
BinaryHeap (const SelfType& heap): ParentType(heap) {}
|
||||||
|
|
||||||
#if defined(QSE_CPP_ENABLE_CPP11_MOVE)
|
#if defined(QSE_CPP_ENABLE_CPP11_MOVE)
|
||||||
BinaryHeap (SelfType&& heap): ParentType (QSE_CPP_RVREF(heap)) {}
|
BinaryHeap (SelfType&& heap): ParentType(QSE_CPP_RVREF(heap)) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
~BinaryHeap () {}
|
~BinaryHeap () {}
|
||||||
|
@ -137,7 +137,7 @@ private:
|
|||||||
this->nodes[i] = QSE_NULL;
|
this->nodes[i] = QSE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->datum_list = new(this->getMmgr()) DatumList (this->getMmgr(), mpb_size);
|
this->datum_list = new(this->getMmgr()) DatumList(mpb_size, this->getMmgr());
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@ -163,20 +163,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
HashList (
|
HashList (
|
||||||
qse_size_t node_capacity = DEFAULT_CAPACITY,
|
Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
|
||||||
qse_size_t load_factor = DEFAULT_LOAD_FACTOR,
|
|
||||||
qse_size_t mpb_size = 0): Mmged(QSE_NULL)
|
|
||||||
{
|
{
|
||||||
this->init_list (node_capacity, load_factor, mpb_size);
|
this->init_list (DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashList (
|
HashList (qse_size_t node_capacity, qse_size_t load_factor = DEFAULT_LOAD_FACTOR, qse_size_t mpb_size = 0, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
|
||||||
Mmgr* mmgr,
|
|
||||||
qse_size_t node_capacity = DEFAULT_CAPACITY,
|
|
||||||
qse_size_t load_factor = DEFAULT_LOAD_FACTOR,
|
|
||||||
qse_size_t mpb_size = 0): Mmged(mmgr)
|
|
||||||
{
|
{
|
||||||
this->init_list (node_capacity, load_factor, mpb_size);
|
this->init_list (DEFAULT_CAPACITY, load_factor, mpb_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashList (const SelfType& list): Mmged(list)
|
HashList (const SelfType& list): Mmged(list)
|
||||||
@ -198,8 +192,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// placement new
|
// placement new
|
||||||
this->datum_list = new(list.getMmgr())
|
this->datum_list = new(list.getMmgr()) DatumList(list.getMpool().getBlockSize(), list.getMmgr());
|
||||||
DatumList (list.getMmgr(), list.getMpool().getBlockSize());
|
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@ -675,7 +668,7 @@ protected:
|
|||||||
// to be inserted are yielded off the original list and inserted
|
// to be inserted are yielded off the original list and inserted
|
||||||
// without new allocation.
|
// without new allocation.
|
||||||
//SelfType temp (this->getMmgr(), this->_resizer(this->node_capacity), this->load_factor, mpool.getBlockSize());
|
//SelfType temp (this->getMmgr(), this->_resizer(this->node_capacity), this->load_factor, mpool.getBlockSize());
|
||||||
SelfType temp (this->getMmgr(), this->_resizer(this->node_capacity, this->getGrowthPolicy()), this->load_factor, 0);
|
SelfType temp (this->_resizer(this->node_capacity, this->getGrowthPolicy()), this->load_factor, 0, this->getMmgr());
|
||||||
Node* p = this->datum_list->getHeadNode();
|
Node* p = this->datum_list->getHeadNode();
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
|
@ -121,18 +121,17 @@ public:
|
|||||||
MIN_LOAD_FACTOR = PairList::MIN_LOAD_FACTOR
|
MIN_LOAD_FACTOR = PairList::MIN_LOAD_FACTOR
|
||||||
};
|
};
|
||||||
|
|
||||||
HashTable (qse_size_t capacity = DEFAULT_CAPACITY,
|
HashTable (Mmgr* mmgr = QSE_NULL):
|
||||||
qse_size_t load_factor = DEFAULT_LOAD_FACTOR,
|
Mmged(mmgr), pair_list(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, 0, mmgr)
|
||||||
qse_size_t mpb_size = 0):
|
|
||||||
Mmged(QSE_NULL), pair_list(QSE_NULL, capacity, load_factor, mpb_size)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
HashTable (Mmgr* mmgr,
|
|
||||||
qse_size_t capacity = DEFAULT_CAPACITY,
|
HashTable (qse_size_t capacity,
|
||||||
qse_size_t load_factor = DEFAULT_LOAD_FACTOR,
|
qse_size_t load_factor = DEFAULT_LOAD_FACTOR,
|
||||||
qse_size_t mpb_size = 0):
|
qse_size_t mpb_size = 0,
|
||||||
Mmged(mmgr), pair_list(mmgr, capacity, load_factor, mpb_size)
|
Mmgr* mmgr = QSE_NULL):
|
||||||
|
Mmged(mmgr), pair_list(capacity, load_factor, mpb_size, mmgr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ QSE_BEGIN_NAMESPACE(QSE)
|
|||||||
/// managed by another memory manager.
|
/// managed by another memory manager.
|
||||||
///
|
///
|
||||||
/// \code
|
/// \code
|
||||||
/// QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
/// QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
/// QSE::LinkedList<int> int_list (&heap_mmgr);
|
/// QSE::LinkedList<int> int_list (&heap_mmgr);
|
||||||
/// int_list.append (10);
|
/// int_list.append (10);
|
||||||
/// int_list.append (20);
|
/// int_list.append (20);
|
||||||
@ -49,11 +49,9 @@ QSE_BEGIN_NAMESPACE(QSE)
|
|||||||
class QSE_EXPORT HeapMmgr: public Mmgr, public Mmged
|
class QSE_EXPORT HeapMmgr: public Mmgr, public Mmged
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HeapMmgr (qse_size_t heap_size) QSE_CPP_NOEXCEPT;
|
|
||||||
|
|
||||||
/// The constructor function accepts an memory manager \a mmgr that
|
/// The constructor function accepts an memory manager \a mmgr that
|
||||||
/// is used to create a heap of the size \a heap_size.
|
/// is used to create a heap of the size \a heap_size.
|
||||||
HeapMmgr (Mmgr* mmgr, qse_size_t heap_size) QSE_CPP_NOEXCEPT;
|
HeapMmgr (qse_size_t heap_size, Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT;
|
||||||
|
|
||||||
/// The destructor function frees the heap. Memory areas returned by
|
/// The destructor function frees the heap. Memory areas returned by
|
||||||
/// allocate(), reallocate(), allocMem(), reallocMem() are invalidated
|
/// allocate(), reallocate(), allocMem(), reallocMem() are invalidated
|
||||||
|
@ -211,16 +211,14 @@ public:
|
|||||||
this->clear (true);
|
this->clear (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList (qse_size_t mpb_size = 0):
|
LinkedList (Mmgr* mmgr = QSE_NULL): Mmged(mmgr), mp(QSE_NULL, QSE_SIZEOF(Node), 0)
|
||||||
Mmged(QSE_NULL), mp(QSE_NULL, QSE_SIZEOF(Node), mpb_size)
|
|
||||||
{
|
{
|
||||||
this->node_count = 0;
|
this->node_count = 0;
|
||||||
this->head_node = QSE_NULL;
|
this->head_node = QSE_NULL;
|
||||||
this->tail_node = QSE_NULL;
|
this->tail_node = QSE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList (Mmgr* mmgr, qse_size_t mpb_size = 0):
|
LinkedList (qse_size_t mpb_size, Mmgr* mmgr = QSE_NULL): Mmged(mmgr), mp(mmgr, QSE_SIZEOF(Node), mpb_size)
|
||||||
Mmged(mmgr), mp(mmgr, QSE_SIZEOF(Node), mpb_size)
|
|
||||||
{
|
{
|
||||||
this->node_count = 0;
|
this->node_count = 0;
|
||||||
this->head_node = QSE_NULL;
|
this->head_node = QSE_NULL;
|
||||||
|
@ -98,13 +98,11 @@ public:
|
|||||||
typedef typename PairTree::ConstIterator ConstIterator;
|
typedef typename PairTree::ConstIterator ConstIterator;
|
||||||
|
|
||||||
|
|
||||||
RedBlackTable (qse_size_t mpb_size = 0):
|
RedBlackTable (Mmgr* mmgr = QSE_NULL): Mmged(mmgr), pair_tree(mmgr, 0)
|
||||||
Mmged(QSE_NULL), pair_tree(QSE_NULL, mpb_size)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RedBlackTable (Mmgr* mmgr, qse_size_t mpb_size = 0):
|
RedBlackTable (qse_size_t mpb_size, Mmgr* mmgr = QSE_NULL): Mmged(mmgr), pair_tree(mpb_size, mmgr)
|
||||||
Mmged(mmgr), pair_tree(mmgr, mpb_size)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,18 +340,17 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RedBlackTree (qse_size_t mpb_size = 0):
|
RedBlackTree (Mmgr* mmgr = QSE_NULL): Mmged(mmgr), mp(mmgr, QSE_SIZEOF(Node), 0), node_count(0)
|
||||||
Mmged(QSE_NULL), mp(QSE_NULL, QSE_SIZEOF(Node), mpb_size), node_count(0)
|
|
||||||
{
|
{
|
||||||
this->init_tree ();
|
this->init_tree ();
|
||||||
}
|
}
|
||||||
|
|
||||||
RedBlackTree (Mmgr* mmgr, qse_size_t mpb_size = 0):
|
RedBlackTree (qse_size_t mpb_size, Mmgr* mmgr = QSE_NULL): Mmged(mmgr), mp(QSE_NULL, QSE_SIZEOF(Node), mpb_size), node_count(0)
|
||||||
Mmged(mmgr), mp(mmgr, QSE_SIZEOF(Node), mpb_size), node_count(0)
|
|
||||||
{
|
{
|
||||||
this->init_tree ();
|
this->init_tree ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RedBlackTree (const SelfType& rbt):
|
RedBlackTree (const SelfType& rbt):
|
||||||
Mmged(rbt.getMmgr()),
|
Mmged(rbt.getMmgr()),
|
||||||
mp(rbt.getMmgr(), rbt.mp.getDatumSize(), rbt.mp.getBlockSize()),
|
mp(rbt.getMmgr(), rbt.mp.getDatumSize(), rbt.mp.getBlockSize()),
|
||||||
|
@ -46,9 +46,11 @@ public:
|
|||||||
void* reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT;
|
void* reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT;
|
||||||
void freeMem (void* ptr) QSE_CPP_NOEXCEPT;
|
void freeMem (void* ptr) QSE_CPP_NOEXCEPT;
|
||||||
|
|
||||||
|
#if 0
|
||||||
/// The getInstance() function returns the stock instance of the StdMmgr
|
/// The getInstance() function returns the stock instance of the StdMmgr
|
||||||
/// class.
|
/// class.
|
||||||
static StdMmgr* getInstance () QSE_CPP_NOEXCEPT;
|
static StdMmgr* getInstance () QSE_CPP_NOEXCEPT;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
@ -185,8 +185,7 @@ private:
|
|||||||
typedef StrBase<qse_wchar_t, QSE_WT('\0'), WcStringOpset> ParentType;
|
typedef StrBase<qse_wchar_t, QSE_WT('\0'), WcStringOpset> ParentType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WcString (): ParentType() {}
|
WcString (Mmgr* mmgr = QSE_NULL): ParentType(mmgr) {}
|
||||||
WcString (Mmgr* mmgr): ParentType(mmgr) {}
|
|
||||||
WcString (int capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
WcString (int capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
||||||
WcString (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
WcString (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
||||||
WcString (const qse_wchar_t* str, Mmgr* mmgr = QSE_NULL): ParentType(str, mmgr) {}
|
WcString (const qse_wchar_t* str, Mmgr* mmgr = QSE_NULL): ParentType(str, mmgr) {}
|
||||||
@ -217,8 +216,7 @@ private:
|
|||||||
typedef StrBase<qse_mchar_t, QSE_MT('\0'), MbStringOpset> ParentType;
|
typedef StrBase<qse_mchar_t, QSE_MT('\0'), MbStringOpset> ParentType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MbString (): ParentType() {}
|
MbString (Mmgr* mmgr = QSE_NULL): ParentType(mmgr) {}
|
||||||
MbString (Mmgr* mmgr): ParentType(mmgr) {}
|
|
||||||
MbString (int capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
MbString (int capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
||||||
MbString (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
MbString (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
|
||||||
MbString (const qse_mchar_t* str, Mmgr* mmgr = QSE_NULL): ParentType(str, mmgr) {}
|
MbString (const qse_mchar_t* str, Mmgr* mmgr = QSE_NULL): ParentType(str, mmgr) {}
|
||||||
|
@ -36,10 +36,10 @@ class SttpCmd: public QSE::Array<QSE::String>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SttpCmd (const qse_char_t* n = QSE_T(""), QSE::Mmgr* mmgr = QSE_NULL):
|
SttpCmd (const qse_char_t* n = QSE_T(""), QSE::Mmgr* mmgr = QSE_NULL):
|
||||||
QSE::Array<QSE::String>(mmgr, 20), name (n) {}
|
QSE::Array<QSE::String>(20, mmgr), name (n) {}
|
||||||
|
|
||||||
SttpCmd (const QSE::String& n, QSE::Mmgr* mmgr = QSE_NULL):
|
SttpCmd (const QSE::String& n, QSE::Mmgr* mmgr = QSE_NULL):
|
||||||
QSE::Array<QSE::String>(mmgr, 20), name (n) {}
|
QSE::Array<QSE::String>(20, mmgr), name (n) {}
|
||||||
|
|
||||||
qse_size_t getArgCount () const
|
qse_size_t getArgCount () const
|
||||||
{
|
{
|
||||||
|
@ -36,12 +36,7 @@ struct xma_xtn_t
|
|||||||
HeapMmgr* heap;
|
HeapMmgr* heap;
|
||||||
};
|
};
|
||||||
|
|
||||||
HeapMmgr::HeapMmgr (qse_size_t heap_size) QSE_CPP_NOEXCEPT:
|
HeapMmgr::HeapMmgr (qse_size_t heap_size, Mmgr* mmgr) QSE_CPP_NOEXCEPT:
|
||||||
Mmgr(), Mmged(QSE_NULL), xma(QSE_NULL), heap_size (heap_size)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
HeapMmgr::HeapMmgr (Mmgr* mmgr, qse_size_t heap_size) QSE_CPP_NOEXCEPT:
|
|
||||||
Mmgr(), Mmged(mmgr), xma(QSE_NULL), heap_size (heap_size)
|
Mmgr(), Mmged(mmgr), xma(QSE_NULL), heap_size (heap_size)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,26 @@ void* Mmgr::callocate (qse_size_t n, bool raise_exception) QSE_CPP_THREXCEPT1(Me
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mmgr* Mmgr::dfl_mmgr = StdMmgr::getInstance();
|
#if 0
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
static StdMmgr __attribute__((init_priority(101))) std_dfl_mmgr;
|
||||||
|
#else
|
||||||
|
static StdMmgr std_dfl_mmgr;
|
||||||
|
#endif
|
||||||
|
Mmgr* Mmgr::dfl_mmgr = &std_dfl_mmgr;
|
||||||
|
//Mmgr* Mmgr::dfl_mmgr = StdMmgr::getInstance(); <--- has an issue with initialization order
|
||||||
|
#else
|
||||||
|
// C++ initialization order across translation units are not defined.
|
||||||
|
// so it's tricky to work around this... the init_priority attribute
|
||||||
|
// can solve this problem. but it's compiler dependent.
|
||||||
|
// Mmgr::getDFL() resets dfl_mmgr to &std_dfl_mmgr if it's NULL.
|
||||||
|
Mmgr* Mmgr::dfl_mmgr = QSE_NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
Mmgr* Mmgr::getDFL () QSE_CPP_NOEXCEPT
|
Mmgr* Mmgr::getDFL () QSE_CPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
static StdMmgr std_dfl_mmgr;
|
||||||
|
if (!Mmgr::dfl_mmgr) Mmgr::dfl_mmgr = &std_dfl_mmgr;
|
||||||
return Mmgr::dfl_mmgr;
|
return Mmgr::dfl_mmgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,14 @@ void StdMmgr::freeMem (void* ptr) QSE_CPP_NOEXCEPT
|
|||||||
::free (ptr);
|
::free (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
StdMmgr* StdMmgr::getInstance () QSE_CPP_NOEXCEPT
|
StdMmgr* StdMmgr::getInstance () QSE_CPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
static StdMmgr DFL;
|
static StdMmgr DFL;
|
||||||
return &DFL;
|
return &DFL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
QSE_END_NAMESPACE(QSE)
|
QSE_END_NAMESPACE(QSE)
|
||||||
|
@ -73,8 +73,8 @@ typedef QSE::Array<PosStr> StrArray;
|
|||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
//StrArray h (QSE_NULL, 100);
|
//StrArray h (100);
|
||||||
StrArray h (QSE_NULL, 15);
|
StrArray h (15);
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
for (int i = 0; i < 20; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
|
@ -93,8 +93,8 @@ printf ("================\n");
|
|||||||
printf ("----------------------\n");
|
printf ("----------------------\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//QSE::HashList<T> h (mmgr, 1000, 75, 1000);
|
//QSE::HashList<T> h (1000, 75, 1000, mmgr);
|
||||||
QSE::HashList<T> h (mmgr, 1000, 75, 500);
|
QSE::HashList<T> h (1000, 75, 500, mmgr);
|
||||||
for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
{
|
{
|
||||||
T x(i);
|
T x(i);
|
||||||
@ -102,7 +102,7 @@ for (int i = 0; i < 1000; i++)
|
|||||||
}
|
}
|
||||||
printf ("h.getSize() => %d\n", (int)h.getSize());
|
printf ("h.getSize() => %d\n", (int)h.getSize());
|
||||||
|
|
||||||
QSE::HashList<T> h2 (mmgr, 1000, 75, 700);
|
QSE::HashList<T> h2 (1000, 75, 700, mmgr);
|
||||||
h2 = h;
|
h2 = h;
|
||||||
|
|
||||||
for (QSE::HashList<T>::Iterator it = h2.getIterator(); it.isLegit(); it++)
|
for (QSE::HashList<T>::Iterator it = h2.getIterator(); it.isLegit(); it++)
|
||||||
|
@ -71,10 +71,10 @@ int main ()
|
|||||||
{
|
{
|
||||||
// qse_open_stdsios ();
|
// qse_open_stdsios ();
|
||||||
|
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 3000000);
|
QSE::HeapMmgr heap_mmgr (3000000, QSE::Mmgr::getDFL());
|
||||||
//QSE::HashTable<int,int,IntHasher> int_table (&heap_mmgr, 1000);
|
//QSE::HashTable<int,int,IntHasher> int_table (&heap_mmgr, 1000);
|
||||||
IntTable int_table (NULL, IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 1000);
|
IntTable int_table (IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 1000);
|
||||||
//IntTable int_table (NULL, IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 0);
|
//IntTable int_table (IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 0);
|
||||||
printf ("----------\n");
|
printf ("----------\n");
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
@ -112,8 +112,8 @@ printf ("----------\n");
|
|||||||
printf ("%d\n", int_table[9990]);
|
printf ("%d\n", int_table[9990]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Str1Table s1 (NULL, IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 1000);
|
//Str1Table s1 (IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 1000);
|
||||||
Str1Table s1 (NULL, IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 0);
|
Str1Table s1 (IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 0);
|
||||||
//Str1Table s1;
|
//Str1Table s1;
|
||||||
s1.insert ("hello", 20);
|
s1.insert ("hello", 20);
|
||||||
s1.insert ("hello", 20);
|
s1.insert ("hello", 20);
|
||||||
@ -150,8 +150,8 @@ printf ("----------\n");
|
|||||||
|
|
||||||
printf ("------------------\n");
|
printf ("------------------\n");
|
||||||
{
|
{
|
||||||
Str1Table s11 (&heap_mmgr, IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 0);
|
Str1Table s11 (IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 0, &heap_mmgr);
|
||||||
//Str1Table s11 (NULL, IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 200);
|
//Str1Table s11 (IntTable::DEFAULT_CAPACITY, IntTable::DEFAULT_LOAD_FACTOR, 200);
|
||||||
//Str1Table s11;
|
//Str1Table s11;
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
|
@ -22,7 +22,7 @@ typedef QSE::RedBlackTree<IntPair> IntTree;
|
|||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
|
|
||||||
IntTree t (0, 10000);
|
IntTree t (10000, QSE_NULL);
|
||||||
//IntTree t (0);
|
//IntTree t (0);
|
||||||
|
|
||||||
for (int i = 0; i < 20 ; i++)
|
for (int i = 0; i < 20 ; i++)
|
||||||
@ -54,7 +54,7 @@ int main ()
|
|||||||
printf ("------------------\n");
|
printf ("------------------\n");
|
||||||
t.insert (IntPair(99, 999));
|
t.insert (IntPair(99, 999));
|
||||||
t.insert (IntPair(88, 888));
|
t.insert (IntPair(88, 888));
|
||||||
//IntTree y (QSE_NULL, 5);
|
//IntTree y (5, QSE_NULL);
|
||||||
x = t;
|
x = t;
|
||||||
for (it = x.getConstIterator(); it.isLegit(); ++it)
|
for (it = x.getConstIterator(); it.isLegit(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -39,10 +39,10 @@ int main ()
|
|||||||
{
|
{
|
||||||
// qse_open_stdsios ();
|
// qse_open_stdsios ();
|
||||||
|
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 3000000);
|
QSE::HeapMmgr heap_mmgr (3000000, QSE::Mmgr::getDFL());
|
||||||
//QSE::RedBlackTable<int,int,IntHasher> int_table (&heap_mmgr, 1000);
|
//QSE::RedBlackTable<int,int,IntHasher> int_table (1000, &heap_mmgr);
|
||||||
IntTable int_table (NULL, 1000);
|
IntTable int_table (1000, QSE_NULL);
|
||||||
//IntTable int_table (NULL, 0);
|
//IntTable int_table (0, QSE_NULL);
|
||||||
printf ("----------\n");
|
printf ("----------\n");
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
@ -80,8 +80,8 @@ printf ("----------\n");
|
|||||||
printf ("%d\n", int_table[9990]);
|
printf ("%d\n", int_table[9990]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Str1Table s1 (NULL, 1000);
|
//Str1Table s1 (1000, QSE_NULL);
|
||||||
Str1Table s1 (NULL, 0);
|
Str1Table s1 (0, QSE_NULL);
|
||||||
//Str1Table s1;
|
//Str1Table s1;
|
||||||
s1.insert ("hello", 20);
|
s1.insert ("hello", 20);
|
||||||
s1.insert ("hello", 20);
|
s1.insert ("hello", 20);
|
||||||
@ -118,8 +118,8 @@ printf ("----------\n");
|
|||||||
|
|
||||||
printf ("------------------\n");
|
printf ("------------------\n");
|
||||||
{
|
{
|
||||||
Str1Table s11 (&heap_mmgr, 0);
|
Str1Table s11 (0, &heap_mmgr);
|
||||||
//Str1Table s11 (NULL, 200);
|
//Str1Table s11 (200, QSE_NULL);
|
||||||
//Str1Table s11;
|
//Str1Table s11;
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
|
@ -28,7 +28,7 @@ struct destroy_x_in_mmgr
|
|||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
|
|
||||||
{
|
{
|
||||||
QSE::ScopedPtr<X> x1 (new X);
|
QSE::ScopedPtr<X> x1 (new X);
|
||||||
|
@ -45,8 +45,8 @@ struct destroy_x_in_mmgr
|
|||||||
|
|
||||||
int f2 ()
|
int f2 ()
|
||||||
{
|
{
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
QSE::HeapMmgr heap_mmgr_2 (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr heap_mmgr_2 (30000, QSE::Mmgr::getDFL());
|
||||||
QSE::SharedPtr<X> y (new X(1));
|
QSE::SharedPtr<X> y (new X(1));
|
||||||
QSE::SharedPtr<X,QSE::SharedPtrMmgrDeleter<X> > k (&heap_mmgr);
|
QSE::SharedPtr<X,QSE::SharedPtrMmgrDeleter<X> > k (&heap_mmgr);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
void t1 ()
|
void t1 ()
|
||||||
{
|
{
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
QSE::String* z = new QSE::String();
|
QSE::String* z = new QSE::String();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ protected:
|
|||||||
|
|
||||||
static int test1()
|
static int test1()
|
||||||
{
|
{
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
MyApp app (&heap_mmgr);
|
MyApp app (&heap_mmgr);
|
||||||
|
|
||||||
MyApp app2 (&heap_mmgr);
|
MyApp app2 (&heap_mmgr);
|
||||||
|
@ -62,7 +62,7 @@ static QSE::TcpServerF<ClientHandler>* g_server;
|
|||||||
|
|
||||||
static int test1 (void)
|
static int test1 (void)
|
||||||
{
|
{
|
||||||
QSE::HeapMmgr heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
|
|
||||||
#if defined(QSE_LANG_CPP11)
|
#if defined(QSE_LANG_CPP11)
|
||||||
QSE::TcpServerL<int(QSE::TcpServer::Worker*)> server (
|
QSE::TcpServerL<int(QSE::TcpServer::Worker*)> server (
|
||||||
|
@ -18,7 +18,7 @@ static int g_stopreq = 0;
|
|||||||
static qse_ntime_t sleep_interval = { 1, 0 };
|
static qse_ntime_t sleep_interval = { 1, 0 };
|
||||||
|
|
||||||
|
|
||||||
QSE::HeapMmgr g_heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr g_heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
|
|
||||||
class MyThread: public QSE::Thread
|
class MyThread: public QSE::Thread
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
static int g_stopreq = 0;
|
static int g_stopreq = 0;
|
||||||
static qse_ntime_t sleep_interval = { 1, 0 };
|
static qse_ntime_t sleep_interval = { 1, 0 };
|
||||||
|
|
||||||
QSE::HeapMmgr g_heap_mmgr (QSE::Mmgr::getDFL(), 30000);
|
QSE::HeapMmgr g_heap_mmgr (30000, QSE::Mmgr::getDFL());
|
||||||
|
|
||||||
struct rq_data_t
|
struct rq_data_t
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user