C++ - class type argument deduction

less than 1 minute read

The standard has the following CTAD(Class Type Argument Deduction) for array type

1
2
template<class T, class... U>
array(T, U...) -> array<common_type_t<T, U...>, 1 + sizeof...(U)>;

We can use the following definition

1
std::array arr{1, 2, 3};

This will become

1
array<int, 3>

Categories:

Updated: