copy_if.h
Go to the documentation of this file.
00001 #ifndef _COPY_IF_H
00002 #define _COPY_IF_H
00003 
00004 namespace osl
00005 {
00006   namespace stl
00007   {
00013     template<class InputIterator, class OutputIterator, class Predicate>
00014     inline OutputIterator copy_if(InputIterator first, 
00015                                   InputIterator last, 
00016                                   OutputIterator result, 
00017                                   Predicate predicate)
00018     {
00019       while (first != last) {
00020         if (predicate(*first)) {
00021           *result++ = *first;
00022         }
00023         ++first;
00024       }
00025       return result;
00026     }
00027   } // stl
00028 } // osl
00029 
00030 #endif /* _COPY_IF_H */
00031 // ;;; Local Variables:
00032 // ;;; mode:c++
00033 // ;;; c-basic-offset:2
00034 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines