DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

for_each(C++)


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(C++), fill(C++), generate(C++), subs(C++), Block(C++)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005