# deduction guides for `std::span`

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

Defined in header `<span>` |  |
template<class T, std::size_t N> span(T (&)[N]) -> span<T, N>; | (1) |
template<class T, std::size_t N> span(std::array<T, N>&) -> span<T, N>; | (2) |
template<class T, std::size_t N> span(const std::array<T, N>&) -> span<const T, N>; | (3) |
template<class Container> span(Container&) -> span<typename Container::value_type>; | (4) |
template<class Container> span(const Container&) -> span<const typename Container::value_type>; | (5) |

Five deduction guides are provided for `span`.

(1-3) allow the static extent to be deduced from built-in arrays and std::array.

(4-5) allow the element type to be deduced from containers that supply a nested type `value_type`.

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