Why don't I need to specify “typename” before a dependent type in C++20?

前端 未结 2 643
天涯浪人
天涯浪人 2020-12-08 01:33

This bit of code compiled in C++20 (using gcc 10.1) without using the typename keyword before the dependent type std::vector::iterator. Wh

2条回答
  •  不知归路
    2020-12-08 02:16

    From the reference, from c++20, in contexts where the dependent name is unambiguously a typename, the typename keyword is no longer needed. In particular:

    A qualified name that is used as a declaration specifier in the (top-level) decl-specifier-seq of:

    a simple declaration or function definition at namespace scope

提交回复
热议问题