constexpr for make_span (#627)

This commit is contained in:
beinhaerter 2018-02-23 22:35:36 +01:00 committed by Neil MacIntosh
parent b3870ca020
commit 7eb8f41af5

View File

@ -619,43 +619,43 @@ as_writeable_bytes(span<ElementType, Extent> s) GSL_NOEXCEPT
// make_span() - Utility functions for creating spans
//
template <class ElementType>
span<ElementType> make_span(ElementType* ptr, typename span<ElementType>::index_type count)
constexpr span<ElementType> make_span(ElementType* ptr, typename span<ElementType>::index_type count)
{
return span<ElementType>(ptr, count);
}
template <class ElementType>
span<ElementType> make_span(ElementType* firstElem, ElementType* lastElem)
constexpr span<ElementType> make_span(ElementType* firstElem, ElementType* lastElem)
{
return span<ElementType>(firstElem, lastElem);
}
template <class ElementType, std::size_t N>
span<ElementType, N> make_span(ElementType (&arr)[N])
constexpr span<ElementType, N> make_span(ElementType (&arr)[N])
{
return span<ElementType, N>(arr);
}
template <class Container>
span<typename Container::value_type> make_span(Container& cont)
constexpr span<typename Container::value_type> make_span(Container& cont)
{
return span<typename Container::value_type>(cont);
}
template <class Container>
span<const typename Container::value_type> make_span(const Container& cont)
constexpr span<const typename Container::value_type> make_span(const Container& cont)
{
return span<const typename Container::value_type>(cont);
}
template <class Ptr>
span<typename Ptr::element_type> make_span(Ptr& cont, std::ptrdiff_t count)
constexpr span<typename Ptr::element_type> make_span(Ptr& cont, std::ptrdiff_t count)
{
return span<typename Ptr::element_type>(cont, count);
}
template <class Ptr>
span<typename Ptr::element_type> make_span(Ptr& cont)
constexpr span<typename Ptr::element_type> make_span(Ptr& cont)
{
return span<typename Ptr::element_type>(cont);
}