当前位置: 首页>>代码示例>>C++>>正文


C++ SimpleList类代码示例

本文整理汇总了C++中SimpleList的典型用法代码示例。如果您正苦于以下问题:C++ SimpleList类的具体用法?C++ SimpleList怎么用?C++ SimpleList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SimpleList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_simple_list

void test_simple_list()
{
    SimpleList<int> slist;
    for (int i = 0; i < 10; ++i) {
        slist.push_back(i);
    }
}
开发者ID:ImTangYun,项目名称:Just_for_test_and_try,代码行数:7,代码来源:main.cpp

示例2: main

int main()
{
    SimpleList l;
    char c;

    printf("testing insert/remove...");
    if (!l.insert(-1, 'a'))
        goto fail;
    if (!l.insert(-1, 'b'))
        goto fail;
    if (!l.insert(1, 'c'))
        goto fail;
    if (!l.remove(0, &c) || c != 'a')
        goto fail;
    if (!l.remove(1, &c) || c != 'b')
        goto fail;
    if (!l.remove(0, &c) || c != 'c')
        goto fail;
    printf("[ok]\n");

    printf("testing count...");
    if (l.get_count() != 0)
        goto fail;
    l.insert(-1, 'a');
    if (l.get_count() != 1)
        goto fail;
    printf("[ok]\n");

    return 0;

fail:
    printf("[failed]\n");
    return -1;
}
开发者ID:prabhakaran9397,项目名称:DataStructureLab-2nd-Sem,代码行数:34,代码来源:stub_simplelist.cpp

示例3: copyFloatCategory

void GenericQuery::
copyFloatCategory (SimpleList<float> &to, SimpleList<float> &from)
{
	float item;

	clearFloatCategory (to);
	while (from.Next (item))
		to.Append (item);
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:9,代码来源:generic_query.cpp

示例4: copyIntegerCategory

void GenericQuery::
copyIntegerCategory (SimpleList<int> &to, SimpleList<int> &from)
{
	int item;

	clearIntegerCategory (to);
	while (from.Next (item))
		to.Append (item);
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:9,代码来源:generic_query.cpp

示例5: clearFloatCategory

void GenericQuery::
clearFloatCategory (SimpleList<float> &float_category)
{
    float item;

    float_category.Rewind ();
    while (float_category.Next (item))
        float_category.DeleteCurrent ();
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:9,代码来源:generic_query.cpp

示例6: clearIntegerCategory

void GenericQuery::
clearIntegerCategory (SimpleList<int> &int_category)
{
    int item;

    int_category.Rewind ();
    while (int_category.Next (item))
        int_category.DeleteCurrent ();
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:9,代码来源:generic_query.cpp

示例7: simpleListSetFirst_base

void simpleListSetFirst_base(SimpleList l, const Ptr data) {
    if(l->delFct)
        l->delFct((void *)l->first+sizeof(struct _SimpleListNode));

    if(l->copyFct)
        l->copyFct((void *)l->first+sizeof(struct _SimpleListNode), data);
    else
        memcpy((void *)l->first+sizeof(struct _SimpleListNode), data, l->elemSize);
}
开发者ID:jasonpindat,项目名称:ExtLib,代码行数:9,代码来源:SimpleList.c

示例8: getPlugins

void
CollectorPluginManager::Shutdown()
{
	CollectorPlugin *plugin;
	SimpleList<CollectorPlugin *> plugins = getPlugins();
	plugins.Rewind();
	while (plugins.Next(plugin)) {
		plugin->shutdown();
	}
}
开发者ID:brianhlin,项目名称:htcondor,代码行数:10,代码来源:CollectorPluginManager.cpp

示例9: getPlugins

void
NegotiatorPluginManager::Update(const ClassAd &ad)
{
	NegotiatorPlugin *plugin;
	SimpleList<NegotiatorPlugin *> plugins = getPlugins();
	plugins.Rewind();
	while (plugins.Next(plugin)) {
		plugin->update(ad);
	}
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:10,代码来源:NegotiatorPluginManager.cpp

示例10: testSet

void AbstractSequentialListTest::testSet() {

    SimpleList<int> list;

    try {
        list.set( 0, 12 );
        CPPUNIT_FAIL("should throw IndexOutOfBoundsException");
    } catch( IndexOutOfBoundsException& e ) {
        // expected
    }
}
开发者ID:apache,项目名称:activemq-cpp,代码行数:11,代码来源:AbstractSequentialListTest.cpp

示例11: testAddAll

void AbstractSequentialListTest::testAddAll() {

    LinkedList<int> collection;
    for( int i = 0; i < 50; ++i ) {
        collection.add( i );
    }

    SimpleList<int> list;
    list.addAll( collection );
    CPPUNIT_ASSERT_MESSAGE( "Should return true", list.addAll( 2, collection ) );
}
开发者ID:apache,项目名称:activemq-cpp,代码行数:11,代码来源:AbstractSequentialListTest.cpp

示例12: testIterator

void AbstractListTest::testIterator() {

    SimpleList<int> list;
    list.add( 10 );
    list.add( 20 );
    std::auto_ptr< Iterator<int> > iter( list.iterator() );

    CPPUNIT_ASSERT_EQUAL( 10, iter->next() );
    iter->remove();
    CPPUNIT_ASSERT_EQUAL( 20, iter->next() );
}
开发者ID:apache,项目名称:activemq-cpp,代码行数:11,代码来源:AbstractListTest.cpp

示例13: testIndexOf

void AbstractListTest::testIndexOf() {

    SimpleList<int> array;
    for( int i = 1; i < 6; i++ ) {
        array.add(i);
    }

    MockArrayList<int> list;
    list.addAll( array );

    CPPUNIT_ASSERT_EQUAL_MESSAGE( "find 0 in the list do not contain 0", -1, list.indexOf( 0 ) );
    CPPUNIT_ASSERT_EQUAL_MESSAGE( "did not return the right location of element 3", 2, list.indexOf( 3 ) );
}
开发者ID:apache,项目名称:activemq-cpp,代码行数:13,代码来源:AbstractListTest.cpp

示例14: testRemove

void AbstractSequentialListTest::testRemove() {

    SimpleList<int> list;
    list.add(1);

    CPPUNIT_ASSERT_EQUAL( 1, list.removeAt( 0 ) );

    list.add( 2 );
    CPPUNIT_ASSERT_EQUAL( 2, list.removeAt( 0 ) );

    // remove index is out of bounds
    try {
        list.removeAt( list.size() );
        CPPUNIT_FAIL("Should throw IndexOutOfBoundsException.");
    } catch( IndexOutOfBoundsException& e ) {
        // expected
    }
    try {
        list.removeAt( -1 );
        CPPUNIT_FAIL("Should throw IndexOutOfBoundsException.");
    } catch( IndexOutOfBoundsException& e ) {
        // expected
    }

    // list dont't support remove operation
    try {
        MockAbstractSequentialList<int> mylist;
        mylist.removeAt( 0 );
        CPPUNIT_FAIL("Should throw UnsupportedOperationException.");
    } catch( UnsupportedOperationException& e ) {
        // expected
    }
}
开发者ID:apache,项目名称:activemq-cpp,代码行数:33,代码来源:AbstractSequentialListTest.cpp

示例15: GetListPeerId

int TcpClient::GetListPeerId(SimpleList<unsigned int>& listId)
{
  unsigned int pid = MsgSocket::GetPeerPid();
  if(pid != 0)
	{
	  listId.Add(pid);
	  return 1;
	}
  return 0;
}
开发者ID:AmibisLabs,项目名称:amibis-cpp,代码行数:10,代码来源:TcpClient.cpp


注:本文中的SimpleList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。