Robot Simulator of the Robotics Group for Self-Organization of Control: 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 /// contains some additions to the standard template library
    00014 namespace std {
    00015
    00016   /// absolute function for all types
    00017   template<typename T>
    00018   inline T abs(T v)
    00019   { return ((v>0)?v:-v); }
    00020
    00021   /// += operators for list (list concat)
    00022   template <class T, class A>
    00023     list<T,A>& operator += (list<T,A>& l1, const list<T,A>& l2)
    00024     { l1.insert(l1.end(), l2.begin(), l2.end()); return l1;}
    00025
    00026   /// += operators for list (append)
    00027   template <class T, class A>
    00028     list<T,A>& operator += (list<T,A>& l1, const T& v)
    00029     { l1.push_back(v); return l1;}
    00030
    00031   string itos(int i);
    00032
    00033 }
    00034
    00035 #else
    00036
    00037 #include "avrtypes.h"
    00038
    00039 namespace std {
    00040
    00041   /// absolute function for all types
    00042   template<typename T>
    00043   inline T abs(T v)
    00044   { return ((v>0)?v:-v); }
    00045
    00046   charArray itos(int i);
    00047
    00048 }
    00049
    00050 #endif
    00051
    00052 #endif