title: Why is the pipe operator not working when I use ranges in C++20?
body: <p>I am currently working through examples from the book <em>Expert C++</em>.</p>
  <p>In chapter 7, they offer the following code for mapping a function to a matrix:</p>
  <pre><code>#include &lt;vector&gt;
  #include &lt;ranges&gt;
  #include &lt;iostream&gt;
  
  using IntMatrix = std::vector&lt;std::vector&lt;int&gt;&gt;;
  
  int count_evens(const std::vector&lt;int&gt;&amp; number_line) {
      return std::count_if(number_line.begin(),
                           number_line.end(), [](int num){return num % 2 == 0;});
  }
  
  std::vector&lt;int&gt; count_all_evens(const IntMatrix&amp; numbers)
  {
      return numbers | std::ranges::views::transform(count_evens); // ERROR APPEARS HERE AT |
  }
  
  int main()
  {
      IntMatrix m{{1, 2, 3}, {4, 5, 6}};
      for (auto item : count_all_evens(m)) {
          std::cout &lt;&lt; item &lt;&lt; &quot; &quot;;
      }
      std::cout &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  <p>I am getting an error on line 14 that says:</p>
  <blockquote>
  <pre><code>could not convert 'std::ranges::views::__adaptor::operator|&lt;const std::vector&lt;std::vector&lt;int&gt; &gt;&amp;&gt;((* &amp; numbers), std::ranges::views::transform.std::ranges::views::__adaptor::_RangeAdaptor&lt;std::ranges::views::&lt;lambda(_Range&amp;&amp;, _Fp&amp;&amp;)&gt; &gt;::operator()&lt;int (&amp;)(const std::vector&lt;int, std::allocator&lt;int&gt; &gt;&amp;)&gt;(count_evens))' from 'std::ranges::transform_view&lt;std::ranges::ref_view&lt;const std::vector&lt;std::vector&lt;int&gt; &gt; &gt;, int (*)(const std::vector&lt;int&gt;&amp;)&gt;' to 'std::vector&lt;int&gt;'
  </code></pre>
  </blockquote>
  <p>Does anyone else have this issue? I am using the g++10 compiler.</p>