ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/utils/Algorithm.hpp
(Generate patch)

Comparing trunk/OOPSE-4/src/utils/Algorithm.hpp (file contents):
Revision 2009 by tim, Sun Feb 13 19:14:43 2005 UTC vs.
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC

# Line 43 | Line 43 | namespace oopse {
43  
44   namespace oopse {
45  
46 < /**
47 < * copy_if is one of the missing functions in STL.
48 < * copy_if copies elements from the range [first, last) to the range [result, result + (last-first)),
49 < * except that any element for which pred is false is not copied.
50 < */
51 < template<typename InputIterator, typename OutputIterator, typename Predicate>
52 < OutputIterator copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate p) {
46 >  /**
47 >   * copy_if is one of the missing functions in STL.
48 >   * copy_if copies elements from the range [first, last) to the range [result, result + (last-first)),
49 >   * except that any element for which pred is false is not copied.
50 >   */
51 >  template<typename InputIterator, typename OutputIterator, typename Predicate>
52 >  OutputIterator copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate p) {
53      while (first != last) {
54 <        if (p(*first)) {
55 <            *result++ = *first;
56 <        }
57 <        ++first;
54 >      if (p(*first)) {
55 >        *result++ = *first;
56 >      }
57 >      ++first;
58      }
59  
60      return result;
61 < }
61 >  }
62  
63  
64  
65 < template<typename T>
66 < struct logical_xor :public std::binary_function<T, T, bool> {
65 >  template<typename T>
66 >  struct logical_xor :public std::binary_function<T, T, bool> {
67      double operator()(T x, T y) { return x ^ y; }
68 < };
68 >  };
69  
70   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines