c++14 - what is std::array decay to in forwarding reference -
template <typename t> void test(t&& t) { std::cout << std::is_same_v < t, std::array<int, 2> > << std::endl; std::cout << std::is_same_v < std::decay_t<t>, std::array<int, 2> > << std::endl; std::cout << std::is_array_v< std::decay_t<t> > << std::endl; } void foo { std::array<int, 2> a; test(a); } what std::array decaying to? above code give me following:
0 0 // isn't t decayed std::array<int, 2> ? 0 i surprised 3 zeros thought @ least either first or second true.
Comments
Post a Comment