Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 30, 2010, 8:07:38 PM (14 years ago)
Author:
rgrieder
Message:

There is no such word as "casted".
Also inserted 4 static_casts and replaced dynamic_cast with orxonox_cast in WeakPtr and SmartPtr.
Moreover found some weird code in Iterator.h with casting. Casting a NULL pointer always yields another NULL pointer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/ObjectList.h

    r5738 r7271  
    6161            /** @brief Returns an Iterator to the first element in the list. @return The Iterator */
    6262            inline static ObjectListElement<T>* begin()
    63                 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->begin().element_); }
     63            {
     64                ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
     65                return static_cast<ObjectListElement<T>*>(list->begin().element_);
     66            }
    6467
    6568            /** @brief Returns an Iterator to the element after the last element in the list. @return The Iterator */
    6669            inline static ObjectListElement<T>* end()
    67                 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->end().element_); }
     70            {
     71                ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
     72                return static_cast<ObjectListElement<T>*>(list->end().element_);
     73            }
    6874
    6975            /** @brief Returns an Iterator to the last element in the list. @return The Iterator */
    7076            inline static ObjectListElement<T>* rbegin()
    71                 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rbegin().element_); }
     77            {
     78                ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
     79                return static_cast<ObjectListElement<T>*>(list->rbegin().element_);
     80            }
    7281
    7382            /** @brief Returns an Iterator to the element before the first element in the list. @return The Iterator */
    7483            inline static ObjectListElement<T>* rend()
    75                 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rend().element_); }
     84            {
     85                ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
     86                return static_cast<ObjectListElement<T>*>(list->rend().element_);
     87            }
    7688    };
    7789}
Note: See TracChangeset for help on using the changeset viewer.