};
template <typename Type_>
-void CYSetLast(Type_ *&list, Type_ *item) {
+Type_ *&CYSetLast(Type_ *&list) {
if (list == NULL)
- list = item;
- else {
- Type_ *next(list);
- while (next->next_ != NULL)
- next = next->next_;
- next->next_ = item;
- }
+ return list;
+
+ Type_ *next(list);
+ while (next->next_ != NULL)
+ next = next->next_;
+ return next->next_;
+}
+
+template <typename Type_>
+Type_ *CYGetLast(Type_ *list) {
+ if (list == NULL)
+ return NULL;
+
+ Type_ *next(list);
+ while (next->next_ != NULL)
+ next = next->next_;
+ return next;
}
#define CYForEach(value, list) \