本文整理汇总了C++中CArray::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::getSize方法的具体用法?C++ CArray::getSize怎么用?C++ CArray::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove
// Remove all items from the instance of the CArray<Tbool> class.
static void remove(IWriter& writer, CArray<Tbool>& a_rArray, const Tbool a_cDirectOrder)
{ CALL
writer << STR("CArray<Tbool>(") << STR("size = ") << a_rArray.getSize() << STR(")") << ln;
CArray<Tbool>::TIterator it = (a_cDirectOrder ? a_rArray.getItFirst() : a_rArray.getItLast());
writer << STR("{") << ln;
while (it.isValid())
{
writer << STR(" removed item = ") << *it << ln;
a_cDirectOrder ? it.removeForward() : it.removeBackward();
}
writer << STR("}") << ln;
}
示例2: test
// Launch unit test.
EUnitTestResult test()
{ CALL
CArray<Tsint> a;
CArray<Tsint> b;
UT_ASSERT_ZERO(a.getSize());
UT_ASSERT_ZERO(b.getSize());
// Fill the first array.
UT_ASSERT_CHECK_FILL(a, true);
UT_ASSERT_EQUAL(a.getSize(), 6);
// Fill the second array.
UT_ASSERT_CHECK_FILL(b, false);
UT_ASSERT_EQUAL(b.getSize(), 6);
// Show the first array.
UT_ASSERT_CHECK_SHOW(a, true);
// Show the second array.
UT_ASSERT_CHECK_SHOW(b, false);
// Copy arrays.
CArray<Tsint> c(a);
CArray<Tsint> d(b);
UT_ASSERT_EQUAL(c.getSize(), 6);
UT_ASSERT_EQUAL(d.getSize(), 6);
// Reverse arrays.
c.reverse();
d.reverse();
// Show the first reversed array.
UT_ASSERT_CHECK_SHOW_REVERSED(c, true);
// Show the last reversed array.
UT_ASSERT_CHECK_SHOW_REVERSED(d, false);
// Remove items from the first array.
UT_ASSERT_CHECK_REMOVE(a, true);
UT_ASSERT_ZERO(a.getSize());
// Remove items from the second array.
UT_ASSERT_CHECK_REMOVE(b, false);
UT_ASSERT_ZERO(b.getSize());
// Clear the first reversed array.
UT_ASSERT(c.clear());
UT_ASSERT_ZERO(c.getSize());
// Clear the second reversed array.
UT_ASSERT(d.clear());
UT_ASSERT_ZERO(d.getSize());
// Check serialization functionality.
UT_ASSERT_CHECK_SERIALIZATION();
UT_ACCEPT;
}