Skip to content

テンプレート引数として使用するtype_identity_tはなんのため? #829

Description

@faithandbrave

いまこれの解説にとりかかっているのですが、テンプレート引数として使用されているtype_identity_tがなんのために使われているのかわからず困っています。省略してもサンプルコード内では結果が変わらないように思います。

template <class T, class U>
struct C {
  C(T, U);   // #1
};

template <class T, class U>
C(T, U) -> C<T, std::type_identity_t<U>>; // #2 これ

type_identityの提案文書にも、この利用方法はとくに書いていないように思います。

どなたかこの利用方法の理由がわかる方はいるでしょうか?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions