vec: Add array_slice constructors from non-const and gc vectors
This patch adds constructors of array_slice that are required to create them from non-const (heap or auto) vectors or from GC vectors. gcc/ChangeLog: 2022-08-08 Martin Jambor <mjambor@suse.cz> * vec.h (array_slice): Add constructors for non-const reference to heap vector and pointers to heap vectors.
This commit is contained in:
parent
75f59441cd
commit
15433c214d
1 changed files with 12 additions and 0 deletions
12
gcc/vec.h
12
gcc/vec.h
|
@ -2267,6 +2267,18 @@ public:
|
|||
array_slice (const vec<OtherT> &v)
|
||||
: m_base (v.address ()), m_size (v.length ()) {}
|
||||
|
||||
template<typename OtherT>
|
||||
array_slice (vec<OtherT> &v)
|
||||
: m_base (v.address ()), m_size (v.length ()) {}
|
||||
|
||||
template<typename OtherT>
|
||||
array_slice (const vec<OtherT, va_gc> *v)
|
||||
: m_base (v ? v->address () : nullptr), m_size (v ? v->length () : 0) {}
|
||||
|
||||
template<typename OtherT>
|
||||
array_slice (vec<OtherT, va_gc> *v)
|
||||
: m_base (v ? v->address () : nullptr), m_size (v ? v->length () : 0) {}
|
||||
|
||||
iterator begin () { return m_base; }
|
||||
iterator end () { return m_base + m_size; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue