DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

for_each(3C++)


for_each -- apply a given function to every location in an array

Synopsis

   template <class T>
   void for_each(void (*fun)(T*),T b,T* e);

Assumptions

None.

Description

Applies fun to every location in the array from the leftmost to the rightmost.

Complexity

If N is the size of the array, then complexity is O(N). Exactly N calls to fun are made.

Notes

Because a Block (see Block(3C++)) can always be used wherever an array is called for, Array Algorithms can also be used with Blocks. In fact, these two components were actually designed to be used together.

References

Array_alg(3C++), fill(3C++), generate(3C++), subs(3C++), Block(3C++)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004