12 #define FOREACH(colltype, coll, it) for( colltype::iterator it = (coll).begin(), __end=(coll).end(); it!= __end; ++it)
16 #define FOREACHI(colltype, coll, it, index) int index=0; for( colltype::iterator it = (coll).begin(), __end=(coll).end(); it!= __end; ++it, ++index)
18 #define FOREACHIa(coll, it, index) int index=0; for( auto it = (coll).begin(), __end=(coll).end(); it!= __end; ++it, ++index)
21 #define FOREACHC(colltype, coll, it) for( colltype::const_iterator it = (coll).begin(), __end=(coll).end(); it!= __end ; ++it )
22 #define FOREACHCI(colltype, coll, it, index) int index=0;for( colltype::const_iterator it = (coll).begin(), __end=(coll).end(); it!= __end; ++it, ++index)
25 #define FOREACH2(coll1,coll2, it1,it2) \
26 for( auto it1 = (coll1).begin(), __end1=(coll1).end(), it2 = (coll2).begin(), __end2=(coll2).end(); it1!= __end1 && it2!= __end2; ++it1 , ++it2)
36 {
return ((v>0)?v:-v); }
39 template <
class T,
class A>
41 l1.insert(l1.end(), l2.begin(), l2.end());
46 template <
class T,
class A>
53 template <
class T,
class A>
54 list<T,A>
operator + (
const list<T,A>& l1,
const list<T,A>& l2) {
55 list<T,A> rv(l1.begin(),l1.end());
70 string itos(
int i,
const char *);
72 string ftos(
double i);
74 string ftos(
double i,
const char *);
77 template<
typename Col,
typename T>
80 typename Col::iterator i = find(col.begin(), col.end(), elem);
91 struct join :
public unary_function<T, void>
107 template <
typename A,
typename E>
108 A
reduceList(std::list<E> list, A acc, std::function<A(A,E)> f){
115 template <
typename O,
typename I>
116 std::list<O>
mapList(
const std::list<I>& l, std::function<O (
const I&)> fun){
119 res.push_back(fun(p));
T joined
Definition: stl_adds.h:103
string ftos(double i)
integer to string with default formating
Definition: stl_adds.cpp:42
list< T, A > operator+(const list< T, A > &l1, const list< T, A > &l2)
Definition: stl_adds.h:54
int count
Definition: stl_adds.h:104
unsigned int I
type for matrix indices
Definition: matrix.h:36
T abs(T v)
absolute function for all types
Definition: stl_adds.h:35
list< T, A > & operator+=(list< T, A > &l1, const list< T, A > &l2)
+= operators for list (list concat)
Definition: stl_adds.h:40
join(const T &delimit)
Definition: stl_adds.h:93
A reduceList(std::list< E > list, A acc, std::function< A(A, E)> f)
Definition: stl_adds.h:108
void operator()(const T &s)
Definition: stl_adds.h:94
string itos(int i)
integer to string with default formating
Definition: stl_adds.cpp:30
std::list< O > mapList(const std::list< I > &l, std::function< O(const I &)> fun)
Definition: stl_adds.h:116
const int T
integer constant for use with exp function and (^) operator to transpose the matrix ...
Definition: matrix.cpp:21
Definition: stl_adds.h:91
bool removeElement(Col &col, const T &elem)
Definition: stl_adds.h:78
T delimit
Definition: stl_adds.h:102