本文整理汇总了C++中CBitSet::FExchangeClear方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitSet::FExchangeClear方法的具体用法?C++ CBitSet::FExchangeClear怎么用?C++ CBitSet::FExchangeClear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBitSet
的用法示例。
在下文中一共展示了CBitSet::FExchangeClear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CDouble
//---------------------------------------------------------------------------
// @function:
// CJoinOrderDP::DConnectedness
//
// @doc:
// Return connectedness measure of given component
//
//---------------------------------------------------------------------------
CDouble
CJoinOrderDP::DConnectedness
(
ULONG ulComp
)
{
CBitSet *pbsConnected = GPOS_NEW(m_pmp) CBitSet(m_pmp);
for (ULONG ul = 0; ul < m_ulEdges; ul++)
{
SEdge *pedge = m_rgpedge[ul];
if (pedge->m_pbs->FBit(ulComp))
{
pbsConnected->Union(pedge->m_pbs);
}
}
(void) pbsConnected->FExchangeClear(ulComp);
DOUBLE dConnectedness = (DOUBLE) pbsConnected->CElements() / m_ulComps;
pbsConnected->Release();
return CDouble(dConnectedness);
}
示例2: CBitSet
//---------------------------------------------------------------------------
// @function:
// CBitSetTest::EresUnittest_Removal
//
// @doc:
// Cleanup test
//
//---------------------------------------------------------------------------
GPOS_RESULT
CBitSetTest::EresUnittest_Removal()
{
// create memory pool
CAutoMemoryPool amp;
IMemoryPool *pmp = amp.Pmp();
ULONG cSizeBits = 32;
CBitSet *pbs = GPOS_NEW(pmp) CBitSet(pmp, cSizeBits);
CBitSet *pbsEmpty = GPOS_NEW(pmp) CBitSet(pmp, cSizeBits);
GPOS_ASSERT(pbs->FEqual(pbsEmpty));
GPOS_ASSERT(pbsEmpty->FEqual(pbs));
ULONG cInserts = 10;
for (ULONG i = 0; i < cInserts; i++)
{
pbs->FExchangeSet(i * cSizeBits);
GPOS_ASSERT(i + 1 == pbs->CElements());
}
for (ULONG i = 0; i < cInserts; i++)
{
// cleans up empty links
pbs->FExchangeClear(i * cSizeBits);
GPOS_ASSERT(cInserts - i - 1 == pbs->CElements());
}
GPOS_ASSERT(pbs->FEqual(pbsEmpty));
GPOS_ASSERT(pbsEmpty->FEqual(pbs));
pbs->Release();
pbsEmpty->Release();
return GPOS_OK;
}