Robotsystem of the Robot Group Leipzig: stl_adds.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# stl_adds.h

Go to the documentation of this file.

    00001 #ifndef __STL_ADDS_H
    00002 #define __STL_ADDS_H
    00003
    00004 #ifndef AVR
    00005
    00006 #include<list>
    00007 #include<string>
    00008
    00009 #define FOREACH(colltype, coll, it) for( colltype::iterator it = (coll).begin(); it!= (coll).end(); it++)
    00010 #define FOREACHC(colltype, coll, it) for( colltype::const_iterator it = (coll).begin(); it!= (coll).end() ; it++ )
    00011
    00012
    00013 namespace std {
    00014
    00015   /// absolute function for all types
    00016   template<typename T>
    00017   inline T abs(T v)
    00018   { return ((v>0)?v:-v); }
    00019
    00020   /// += operators for list (list concat)
    00021   template <class T, class A>
    00022     list<T,A>& operator += (list<T,A>& l1, const list<T,A>& l2)
    00023     { l1.insert(l1.end(), l2.begin(), l2.end()); return l1;}
    00024
    00025   /// += operators for list (append)
    00026   template <class T, class A>
    00027     list<T,A>& operator += (list<T,A>& l1, const T& v)
    00028     { l1.push_back(v); return l1;}
    00029
    00030   string itos(int i);
    00031
    00032 }
    00033
    00034 #else
    00035
    00036 #include "avrtypes.h"
    00037
    00038 namespace std {
    00039
    00040   /// absolute function for all types
    00041   template<typename T>
    00042   inline T abs(T v)
    00043   { return ((v>0)?v:-v); }
    00044
    00045   charArray itos(int i);
    00046
    00047 }
    00048
    00049 #endif
    00050
    00051 #endif