mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: BREAK_WHEN_PICKED
git-svn-id: svn://ultimatepp.org/upp/trunk@1930 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
03de5f35f6
commit
316f8b6164
3 changed files with 34 additions and 0 deletions
|
|
@ -164,6 +164,7 @@ public:
|
|||
|
||||
V PickKeys() pick_ { return key; }
|
||||
const V& GetKeys() const { return key; }
|
||||
bool IsPicked(void) const { return key.IsPicked(); }
|
||||
|
||||
// Pick assignment & copy. Picked source can only Clear(), ~AIndex(), operator=, operator<<=
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,23 @@ struct Vector_ {
|
|||
int alloc;
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
void *break_when_picked;
|
||||
|
||||
void BreakWhenPicked(void *ptr)
|
||||
{
|
||||
if(ptr == break_when_picked)
|
||||
__BREAK__;
|
||||
}
|
||||
|
||||
void BREAK_WHEN_PICKED__(void *ptr)
|
||||
{
|
||||
break_when_picked = ptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void VectorReAlloc_(void *v_, int newalloc, int sizeofT)
|
||||
{
|
||||
Vector_ *v = (Vector_*)v_;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
#ifdef _DEBUG
|
||||
void BreakWhenPicked(void *ptr);
|
||||
void BREAK_WHEN_PICKED__(void *ptr);
|
||||
|
||||
template <class T>
|
||||
void BREAK_WHEN_PICKED(T& x)
|
||||
{
|
||||
BREAK_WHEN_PICKED__(&x);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
class Vector : public MoveableAndDeepCopyOption< Vector<T> > {
|
||||
T *vector;
|
||||
|
|
@ -6,7 +17,12 @@ class Vector : public MoveableAndDeepCopyOption< Vector<T> > {
|
|||
|
||||
static void RawFree(T *ptr) { if(ptr) MemoryFree(ptr); }
|
||||
static T *RawAlloc(int& n);
|
||||
|
||||
#ifdef _DEBUG
|
||||
static Vector& SetPicked(pick_ Vector& v) { BreakWhenPicked(&v); Vector& p = (Vector&)(v); p.items = -1; p.vector = NULL; return p; }
|
||||
#else
|
||||
static Vector& SetPicked(pick_ Vector& v) { Vector& p = (Vector&)(v); p.items = -1; p.vector = NULL; return p; }
|
||||
#endif
|
||||
|
||||
void Pick(pick_ Vector<T>& v);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue