Make util::span constructible from any container with data() and size() methods
This commit is contained in:
parent
8985436906
commit
a0e81aaf32
1 changed files with 3 additions and 4 deletions
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <iterator>
|
||||
#include <array>
|
||||
|
||||
namespace psemek::util
|
||||
{
|
||||
|
|
@ -42,10 +41,10 @@ namespace psemek::util
|
|||
, p_end{a + N}
|
||||
{}
|
||||
|
||||
template <std::size_t N>
|
||||
span(std::array<T, N> & a)
|
||||
template <typename Container>
|
||||
span(Container & a)
|
||||
: p_begin{a.data()}
|
||||
, p_end{a.data() + N}
|
||||
, p_end{a.data() + a.size()}
|
||||
{}
|
||||
|
||||
span & operator =(span const &) = default;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue