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
00014 namespace std {
00015
00016
00017 template<typename T>
00018 inline T abs(T v)
00019 { return ((v>0)?v:-v); }
00020
00021
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());
00025 return l1;
00026 }
00027
00028
00029 template <class T, class A>
00030 list<T,A>& operator += (list<T,A>& l1, const T& v) {
00031 l1.push_back(v);
00032 return l1;
00033 }
00034
00035
00036 template <class T, class A>
00037 list<T,A> operator + (const list<T,A>& l1, const list<T,A>& l2) {
00038 list<T,A> rv(l1.begin(),l1.end());
00039 rv += l2;
00040 return rv;
00041 }
00042
00043 string itos(int i);
00044
00045 }
00046
00047 #else
00048
00049 #include "avrtypes.h"
00050
00051 namespace std {
00052
00053
00054 template<typename T>
00055 inline T abs(T v)
00056 { return ((v>0)?v:-v); }
00057
00058 charArray itos(int i);
00059
00060 }
00061
00062 #endif
00063
00064 #endif