# deduction guides for `std::array`

From cppreference.com
< cpp‎ | container‎ | array

Defined in header `<array>` |  |
template <class T, class... U> array(T, U...) -> array<T, 1 + sizeof...(U)>; |  | (since C++17)

One deduction guide is provided for std::array to provide an equivalent of std::experimental::make_array for construction of std::array from a variadic parameter pack.

The program is ill-formed if (std::is_same_v<T, U> && ...) is not true

### Example

Run this code

    #include <array>
    int main()
    {
        int const x = 10;
        std::array a{1, 2, 3, 5, x}; // OK, creates std::array<int, 5>

    //  std::array b{1, 2u}; // Error, all arguments must have same type
    }

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/array/deduction_guides&oldid=94040"