title: Methods with certain functions
body: <p>Is there any way to write these two class methods, without using loops, lambda functions, and other additional functions? I only want to use the functions and functors from libraries algorithm and functional. I have tried to use  while loop and recursion to fugure something out, but still couldn't solve this. I didn't want to post the whole code since it is too long.</p>
  <p>(I don't have to use these libraries for &lt;&lt; operator, if there is a way to solve this without them, and min and max are lists)
  My main goal is not using loops, lambda functions and any additional functions outside the two libraries. EraseNegativeTemperatures is the method which should only erase the registered pairs of temperatures where both of them are negative (I wrote the method in the part which I didn't post, and that method makes pairs where one temperature is from min and the other one from max)</p>
  <p>Operator &lt;&lt; outputs all the registered temperatures, the min ones in one row and the max ones in the second row; the temperatures in one row are separates by space.</p>
  <pre><code>void Temperatures::EraseNegativeTemperatures() {
    for (auto it = max.begin(); it != max.end(); it++) {
      if (*it &lt; 0) {
        auto it1 = it;
        auto it2 = min.begin();
        while (it1 != max.begin()) {
          it2++;
          it1--;
        }
        min.erase(it2);
        it = max.erase(it);
      }
    }
    // std::remove_if(min.begin(), min.end(), std::bind(std::less&lt;int&gt;(),
              max.begin() + std::placeholders::_1 - min.begin(), 0));
  }
  
  // second method
  std::ostream &amp;operator&lt;&lt;(std::ostream &amp;flow, const Temperatures &amp;t) {
    std::for_each(t.min.begin(), t.min.end(),
                  [&amp;flow](int x) { flow &lt;&lt; x &lt;&lt; &quot; &quot;; });
    flow &lt;&lt; std::endl;
    std::for_each(t.max.begin(), t.max.end(),
                  [&amp;flow](int x) { flow &lt;&lt; x &lt;&lt; &quot; &quot;; });
    flow &lt;&lt; std::endl;
    return flow;
  }
  </code></pre>