title: std::invoke_result_t compile time syntax error
body: <p>I'm creating a function that takes an iterable (a container) and its begin and end methods return iterator whose dereference can be modified by a passed lambda. Its sounds complicated, but I'm trying to do something like Python's super neat</p>
  
  <pre><code>modified_iterator = (fn(x) for x in my_iterator)
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>    template&lt;typename Container, typename Fn&gt;
      class IterableWrapper {
      public:
          template&lt;typename Iterator&gt;
          class IteratorWrapper : public Iterator {
          public:
              template&lt;typename ...Args&gt;
              explicit IteratorWrapper(Fn fn, Args ... args) : Iterator(args ...), fn(fn) {}
  
              //typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; not working
              typename std::invoke_result_t&lt;Fn,uint64_t&gt; operator* () const {
                  return fn(Iterator::operator*());
              }
          private:
              Fn fn;
          };
  
          IterableWrapper(const Container&amp;&amp; c, Fn&amp;&amp; fn) : c(std::move(c)), fn(std::forward&lt;Fn&gt;(fn)) {}
  
          auto begin() const {
              return IteratorWrapper&lt;decltype(c.begin())&gt;(fn, c.begin());
          };
  
          auto end() const {
              return IteratorWrapper&lt;decltype(c.end())&gt;(fn, c.end());
          };
  
      private:
          Container c;
          Fn fn;
      };
  
      template&lt;typename C, typename Fn&gt;
      auto wrap_iterable(C&amp; c, Fn&amp;&amp; fn) = delete;
  
      template&lt;typename C, typename Fn&gt;
      auto wrap_iterable(C&amp;&amp; c, Fn&amp;&amp; fn) {
          return IterableWrapper&lt;C, Fn&gt;(std::move(c), std::forward&lt;Fn&gt;(fn));
      }
  </code></pre>
  
  <p>desired usage:</p>
  
  <pre><code>    auto new_iterable = wrap_iterable(std::vector&lt;uint64_t&gt;{1,2,3,4}, [](auto&amp;&amp; item) { return std::pow(item, 2); });
  </code></pre>
  
  <p>I don't want to hardcode <code>uint64_t</code> in the invoke_result in <code>IteratorWrapper::operator*</code>. It should be the return type of <code>operator*</code> in the base class (that is the templated type <code>Iterator</code>).</p>
  
  <p>But replacing the hardcoded header with the commented out return type gives me a compile error. The new header:</p>
  
  <pre><code>typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; operator* () const
  </code></pre>
  
  <p>errors:</p>
  
  <pre><code>In file included from /Users/adam/school/cpp/invertedindex/main.cpp:203:0:
  /Users/adam/school/cpp/invertedindex/inverted_index.hpp:61:105: error: template argument 1 is invalid
               typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; operator* () const {  // typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; not compiling??
                                                                                                           ^~
  /Users/adam/school/cpp/invertedindex/inverted_index.hpp:61:121: error: template argument 2 is invalid
               typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; operator* () const {  // typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; not compiling??
                                                                                                                           ^~~~~
  /Users/adam/school/cpp/invertedindex/inverted_index.hpp:61:127: error: expected identifier before '{' token
               typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; operator* () const {  // typename std::invoke_result_t&lt;Fn, typename std::invoke_result_t&lt;typename Iterator::operator*&gt;&gt; not compiling??
                                                                                                                                 ^
  /Users/adam/school/cpp/invertedindex/inverted_index.hpp:61:127: error: expected unqualified-id before '{' token
  In file included from /Users/adam/school/cpp/invertedindex/main.cpp:203:0:
  </code></pre>