From 2e7bca90b053223797e04ba74cc0934a0354cc8c Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 24 May 2018 21:39:19 +0200 Subject: [PATCH] express: fix PointerToArray coercibility regression, fix clear() This was caused by the assignment operators not being visible to interrogate. --- panda/src/express/pointerToArray.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/panda/src/express/pointerToArray.h b/panda/src/express/pointerToArray.h index 251102f5e3..1df1193b3c 100644 --- a/panda/src/express/pointerToArray.h +++ b/panda/src/express/pointerToArray.h @@ -98,6 +98,8 @@ PUBLISHED: EXTENSION(PointerToArray(PyObject *self, PyObject *source)); + INLINE void clear(); + INLINE size_type size() const; INLINE void push_back(const Element &x); INLINE void pop_back(); @@ -157,6 +159,8 @@ public: INLINE size_type max_size() const; INLINE bool empty() const; + INLINE void clear(); + // Functions specific to vectors. INLINE void reserve(size_type n); INLINE void resize(size_type n); @@ -216,6 +220,9 @@ public: INLINE size_t count(const Element &) const; +#endif // CPPPARSER + +public: // Reassignment is by pointer, not memberwise as with a vector. INLINE PointerToArray & operator = (ReferenceCountedVector *ptr); @@ -224,18 +231,14 @@ public: INLINE PointerToArray & operator = (PointerToArray &&from) noexcept; - INLINE void clear(); - private: TypeHandle _type_handle; -private: // This static empty array is kept around just so we can return something // meaningful when begin() or end() is called and we have a NULL pointer. // It might not be shared properly between different .so's, since it's a // static member of a template class, but we don't really care. static pvector _empty_array; -#endif // CPPPARSER friend class ConstPointerToArray; }; @@ -256,6 +259,8 @@ PUBLISHED: INLINE ConstPointerToArray(const PointerToArray ©); INLINE ConstPointerToArray(const ConstPointerToArray ©); + INLINE void clear(); + typedef TYPENAME pvector::size_type size_type; INLINE size_type size() const; INLINE const Element &get_element(size_type n) const; @@ -311,6 +316,8 @@ PUBLISHED: INLINE size_type max_size() const; INLINE bool empty() const; + INLINE void clear(); + // Functions specific to vectors. INLINE size_type capacity() const; INLINE reference front() const; @@ -342,6 +349,9 @@ PUBLISHED: INLINE size_t count(const Element &) const; +#endif // CPPPARSER + +public: // Reassignment is by pointer, not memberwise as with a vector. INLINE ConstPointerToArray & operator = (ReferenceCountedVector *ptr); @@ -354,18 +364,14 @@ PUBLISHED: INLINE ConstPointerToArray & operator = (ConstPointerToArray &&from) noexcept; - INLINE void clear(); - private: TypeHandle _type_handle; -private: // This static empty array is kept around just so we can return something // meangful when begin() or end() is called and we have a NULL pointer. It // might not be shared properly between different .so's, since it's a static // member of a template class, but we don't really care. static pvector _empty_array; -#endif // CPPPARSER friend class PointerToArray; };