Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 6, 2015, 2:51:14 PM (8 years ago)
Author:
landauf
Message:

no static functions anymore in ObjectList. you need to instantiate an ObjectList to use it.
this allows for prettier for-loop syntax when iterating over an ObjectList of a specific context: for (T* object : ObjectList<T>(context)) { … }

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/test/core/object/IteratorTest.cc

    r10846 r10920  
    5555    TEST_F(IteratorTest, CanAssignIterator)
    5656    {
    57         Iterator<TestInterface> it = ObjectList<TestInterface>::begin();
     57        ObjectList<TestInterface> list;
     58        Iterator<TestInterface> it = list.begin();
    5859    }
    5960
     
    6162    {
    6263        size_t i = 0;
    63         for (Iterator<TestInterface> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
     64        ObjectList<TestInterface> list;
     65        for (Iterator<TestInterface> it = list.begin(); it != list.end(); ++it)
    6466            ++i;
    6567        EXPECT_EQ(0u, i);
     
    7779
    7880        // iterate over interfaces but use a TestClass iterator - now we can call TestClass::test()
    79         for (Iterator<TestClass> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
     81        ObjectList<TestInterface> list;
     82        for (Iterator<TestClass> it = list.begin(); it != list.end(); ++it)
    8083            it->test();
    8184    }
     
    8790
    8891        size_t i = 0;
    89         for (Iterator<TestInterface> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
     92        ObjectList<TestInterface> list;
     93        for (Iterator<TestInterface> it = list.begin(); it != list.end(); ++it)
    9094        {
    9195            ++i;
     
    102106
    103107        size_t i = 0;
    104         for (Iterator<TestClass> it = ObjectList<TestClass>::begin(); it != ObjectList<TestClass>::end(); ++it)
     108        ObjectList<TestClass> list;
     109        for (Iterator<TestClass> it = list.begin(); it != list.end(); ++it)
    105110        {
    106111            ++i;
     
    116121
    117122        size_t i = 0;
    118         for (Iterator<TestClass> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
     123        ObjectList<TestInterface> list;
     124        for (Iterator<TestClass> it = list.begin(); it != list.end(); ++it)
    119125        {
    120126            ++i;
     
    131137
    132138        size_t i = 0;
    133         for (Iterator<TestInterface> it = ObjectList<TestClass>::begin(); it != ObjectList<TestClass>::end(); ++it)
     139        ObjectList<TestClass> list;
     140        for (Iterator<TestInterface> it = list.begin(); it != list.end(); ++it)
    134141        {
    135142            ++i;
Note: See TracChangeset for help on using the changeset viewer.