1

I came accross the following construct while reading this article:

template<typename F, typename...As>
using meta_apply = typename F::template apply<As...>;

Can someone explain to me what does the template keyword mean when it's placed after the scope resolution operator ::? Or better point me to where this usage is described in C++ reference of any kind. I tried looking it up myself but couldn't find any.

EDIT

Consider also this code from the same article:

meta_compose<F0, meta_compose<F1, F2>::template apply>::template apply

Here, the last apply token is not followed either < or > thus its usage is not explained in either of the two alternative questions suggested.

Levi Haskell
  • 795
  • 8
  • 20
  • 1
    See also: http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords. – GManNickG Jan 29 '16 at 19:04
  • I don't think it's a duplicate, please see my edit – Levi Haskell Jan 29 '16 at 19:31
  • 2
    It tells the compiler that the thing afterwards names a template, so that 1) it knows how to parse `<` and 2) it knows that said thing can be used as a template argument for a template template parameter. – T.C. Jan 29 '16 at 19:40
  • In other words to be able to bind it `template class F0` template argument above (in the article)? - I think you answered my question. – Levi Haskell Jan 29 '16 at 20:01

0 Answers0