Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CS Namespace Reference

Functions

template<class T >
CS_FORCEINLINE_TEMPLATEMETHOD void Swap (T &a, T &b)
 
template<class T , class Fn >
CS_FORCEINLINE_TEMPLATEMETHOD Fn & ForEach (T it, Fn &Func)
 
template<class T , class Fn >
CS_FORCEINLINE_TEMPLATEMETHOD Fn & ForEach (T *start, T *end, Fn &Func)
 
template<class T , class Fn , class P >
CS_FORCEINLINE_TEMPLATEMETHOD Fn & ForEach (T it, Fn &Func, P &p)
 

Function Documentation

template<class T , class Fn >
CS_FORCEINLINE_TEMPLATEMETHOD Fn& CS::ForEach ( it,
Fn &  Func 
)

Iterate over all elements in the iterator and perform operation given by Func.

csArray<int> anArray;
anArray.Push (1);
anArray.Push (4);
ForEach (anArray.GetIterator (), OurFunctor ());

Definition at line 52 of file opcodealgorithms.h.

53  {
54  while (it.HasNext ())
55  {
56  Func (it.Next ());
57  }
58  return Func;
59  }
template<class T , class Fn >
CS_FORCEINLINE_TEMPLATEMETHOD Fn& CS::ForEach ( T *  start,
T *  end,
Fn &  Func 
)

Iterate over all elements in the list and perform operation given by Func.

Definition at line 66 of file opcodealgorithms.h.

67  {
68  while (start != end)
69  {
70  Func (*start);
71  start++;
72  }
73  return Func;
74  }
template<class T , class Fn , class P >
CS_FORCEINLINE_TEMPLATEMETHOD Fn& CS::ForEach ( it,
Fn &  Func,
P &  p 
)

Iterate over all elements in the iterator and perform operation given by Func.

Definition at line 81 of file opcodealgorithms.h.

82  {
83  while (it.HasNext ())
84  {
85  Func (it.Next (), p);
86  }
87  return Func;
88  }
template<class T >
CS_FORCEINLINE_TEMPLATEMETHOD void CS::Swap ( T &  a,
T &  b 
)

Swap two elements

Definition at line 34 of file opcodealgorithms.h.

References a, and b.

Referenced by csSort().

35  {
36  T tmp = a;
37  a = b;
38  b = tmp;
39  }