title: Iteratively apply range-v3 views::filter on a container
body: <p>In the <code>for</code> loop in the following code snippet I'm trying to apply <code>views::filter</code>. But it results in type miss match and assignment error.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;numeric&gt;
  #include &lt;range/v3/all.hpp&gt;
  
  int main()
  {
      int limit =100;
      std::vector&lt;int&gt; numbers(100);
      std::iota(numbers.begin(), numbers.end(), 1);
      auto results = numbers | ranges::views::filter([](int n) {return n != 1; });
                             
      int sqrt_limit = std::sqrt(limit);
      for (int i = 2; i &lt;= sqrt_limit; i++)
      {
          results = results | ranges::views::filter([i](int n) {return n == i
              || n % i != 0; });
      }
  }
  </code></pre>
  <blockquote>
  <p>Error C2679   binary '=': no operator found which takes a right-hand operand of type 'ranges::filter_viewranges::filter_view&lt;ranges::ref_view&lt;std::vector&lt;int,std::allocator&lt;int&gt;&gt;,Arg&gt;,main::&lt;lambda_2&gt;&gt;' (or there is no acceptable conversion)`</p>
  </blockquote>
  <p><br><br>
  So basically how can I apply <code>views::filter</code> on <code>numbers</code> ,assign the result in <code>results</code> , then apply <code>views::filter</code> on <code>results</code> and then again assign the result in <code>results</code>?</p>
  <pre><code>std::vector&lt;int&gt; numbers(100);
  std::iota(numbers.begin(), numbers.end(), 1);
  auto results = numbers | ranges::views::filter([](int n) {return n != 1; });
  results = results | ranges::views::filter([i](int n) {return n == 2
          || n % 2 != 0; });
  </code></pre>