nds2-client - Developer 0.16.7
Loading...
Searching...
No Matches
nds_foreach.hh
Go to the documentation of this file.
1#ifndef NDS_FOREACH_HH
2#define NDS_FOREACH_HH
3
4namespace NDS
5{
6
7 namespace detail
8 {
9
22 template < class InputIterator1, class InputIterator2, class Function >
23 Function
24 for_each2( InputIterator1 first1,
25 InputIterator1 last1,
26 InputIterator2 first2,
27 Function fn )
28 {
29 for ( ; first1 != last1; ++first1, ++first2 )
30 {
31 fn( *first1, *first2 );
32 }
33 return fn;
34 }
35
50 template < class InputIterator1,
51 class InputIterator2,
52 class InputIterator3,
53 class Function >
54 Function
55 for_each3( InputIterator1 first1,
56 InputIterator1 last1,
57 InputIterator2 first2,
58 InputIterator3 first3,
59 Function fn )
60 {
61 for ( ; first1 != last1; ++first1, ++first2, ++first3 )
62 {
63 fn( *first1, *first2, *first3 );
64 }
65 return fn;
66 }
67 }
68}
69
70#endif // NDS_FOREACH_HH
Function for_each2(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Function fn)
Apply a given function to all elements of two iteratables.
Definition nds_foreach.hh:24
Function for_each3(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator3 first3, Function fn)
Apply a given function to all elements of three iteratables.
Definition nds_foreach.hh:55
The NDS client namespace.
Definition debug_stream.cc:18