BAN: Modify Span constructors to keep constness correctly
This commit is contained in:
@@ -20,6 +20,10 @@ namespace BAN
|
||||
public:
|
||||
Span() = default;
|
||||
Span(T*, size_type);
|
||||
Span(Span<T>&);
|
||||
template<typename S>
|
||||
requires(is_same_v<T, const S>)
|
||||
Span(const Span<S>&);
|
||||
|
||||
iterator begin() { return iterator(m_data); }
|
||||
iterator end() { return iterator(m_data + m_size); }
|
||||
@@ -51,6 +55,22 @@ namespace BAN
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Span<T>::Span(Span& other)
|
||||
: m_data(other.data())
|
||||
, m_size(other.size())
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template<typename S>
|
||||
requires(is_same_v<T, const S>)
|
||||
Span<T>::Span(const Span<S>& other)
|
||||
: m_data(other.data())
|
||||
, m_size(other.size())
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& Span<T>::operator[](size_type index)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user