本文整理汇总了C++中MoveableArray类的典型用法代码示例。如果您正苦于以下问题:C++ MoveableArray类的具体用法?C++ MoveableArray怎么用?C++ MoveableArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MoveableArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Position
int Position (const INDEX_2 & ind) const
{
int i = HashValue(ind);
while (1)
{
if (hash.Get(i) == ind) return i;
if (hash.Get(i).I1() == invalid) return 0;
i++;
if (i > hash.Size()) i = 1;
}
}
示例2: Set
void Set (const INDEX & ahash, const T & acont)
{
int pos;
PositionCreate (ahash, pos);
hash.Elem(pos) = ahash;
cont.Elem(pos) = acont;
}
示例3: PositionCreate
// returns 1, if new postion is created
int PositionCreate (const INDEX_2 & ind, int & apos)
{
int i = HashValue (ind);
if (hash.Get(i) == ind)
{
apos = i;
return 0;
}
if (hash.Get(i).I1() == invalid)
{
hash.Elem(i) = ind;
apos = i;
return 1;
}
return PositionCreate2 (ind, apos);
}
示例4: hash
// public: //SZ
BASE_INDEX_3_CLOSED_HASHTABLE (int size)
: hash(size)
{
hash.SetName ("i3-hashtable, hash");
invalid = -1;
for (int i = 0; i < size; i++)
hash[i].I1() = invalid;
}
示例5: UsedElements
int UsedElements () const
{
int n = hash.Size();
int cnt = 0;
for (int i = 0; i < n; i++)
if (hash[i].I1() != invalid)
cnt++;
return cnt;
}
示例6: Costs
int Costs (const INDEX_3 & ind) const
{
int i = HashValue(ind);
int c = 1;
while (1)
{
if (hash[i] == ind) return c;
if (hash[i].I1() == invalid) return c;
i = (i+1) % hash.Size();
c++;
}
}
示例7: cont
INDEX_3_CLOSED_HASHTABLE (int size)
: BASE_INDEX_3_CLOSED_HASHTABLE(size), cont(size)
{
cont.SetName ("i3-hashtable, contents");
}
示例8: HashValue
int HashValue (const INDEX_3 & ind) const
{
return (ind.I1() + 15 * ind.I2() + 41 * ind.I3()) % hash.Size();
}
示例9: Get
const T & Get (const INDEX & ahash) const
{
int pos = Position (ahash);
return cont.Get(pos);
}
示例10: GetNEdges
int GetNEdges () const
{ return edge2vert.Size(); }
示例11: SetData
inline void SetData (int pos, const T & acont)
{
cont.Elem(pos) = acont;
}
示例12: SetName
void SetName (const char * aname)
{
cont.SetName(aname);
hash.SetName(aname);
}
示例13: UsedPos
int UsedPos (int pos) const { return ! (hash.Get(pos).I1() == invalid); }
示例14: GetData
void GetData (int pos, T & acont) const
{
acont = cont.Get(pos);
}
示例15: SetSize
void SetSize (int size)
{
BaseSetSize(size);
cont.SetSize(size);
}