C++ Logo

STD-DISCUSSION

Advanced search

Subject: What's the usage of type_identity?
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2020-12-18 00:04:04


Hi,
I have a question.

P1021R3 Filling holes in Class Template Argument Deduction
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1021r3.html

P1814R0 Wording for Class Template Argument Deduction for Alias Templates
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1814r0.html

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 THIS

What's the usage of type_identity?
Why not directly use a constructor?

Thanks,
Akira



STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups