All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
copy_if.h
Go to the documentation of this file.
1 #ifndef _COPY_IF_H
2 #define _COPY_IF_H
3 
4 namespace osl
5 {
6  namespace stl
7  {
13  template<class InputIterator, class OutputIterator, class Predicate>
14  inline OutputIterator copy_if(InputIterator first,
15  InputIterator last,
16  OutputIterator result,
17  Predicate predicate)
18  {
19  while (first != last) {
20  if (predicate(*first)) {
21  *result++ = *first;
22  }
23  ++first;
24  }
25  return result;
26  }
27  } // stl
28 } // osl
29 
30 #endif /* _COPY_IF_H */
31 // ;;; Local Variables:
32 // ;;; mode:c++
33 // ;;; c-basic-offset:2
34 // ;;; End: