W3cubDocs

/C++

deduction guides for std::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.

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/container/span/deduction_guides