/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file pointerToArray.I * @author drose * @date 2000-01-07 */ #ifndef CPPPARSER template pvector PointerToArray::_empty_array; template pvector ConstPointerToArray::_empty_array; /** * */ template INLINE PointerToArray:: PointerToArray(TypeHandle type_handle) : PointerToArrayBase(nullptr), _type_handle(type_handle) { } /** * Return an empty array of size n */ template INLINE PointerToArray PointerToArray::empty_array(size_type n, TypeHandle type_handle) { PointerToArray temp(type_handle); temp.reassign(new ReferenceCountedVector(type_handle)); To new_array(n, type_handle); ((To *)(temp._void_ptr))->swap(new_array); return temp; } /** * */ template INLINE PointerToArray:: PointerToArray(size_type n, const Element &value, TypeHandle type_handle) : PointerToArrayBase(new ReferenceCountedVector(type_handle)), _type_handle(type_handle) { ((To *)(this->_void_ptr))->reserve(n); insert(begin(), n, value); } /** * */ template INLINE PointerToArray:: PointerToArray(const PointerToArray ©) : PointerToArrayBase(copy), _type_handle(copy._type_handle) { } /** * Initializes a PointerToArray by copying existing elements. */ template INLINE PointerToArray:: PointerToArray(const Element *begin, const Element *end, TypeHandle type_handle) : PointerToArrayBase(new ReferenceCountedVector(begin, end, type_handle)), _type_handle(type_handle) { } /** * */ template INLINE PointerToArray:: PointerToArray(PointerToArray &&from) noexcept : PointerToArrayBase(std::move(from)), _type_handle(from._type_handle) { } /** * Initializes the PTA from a vector. */ template INLINE PointerToArray:: PointerToArray(pvector &&from, TypeHandle type_handle) : PointerToArrayBase(new ReferenceCountedVector(std::move(from))), _type_handle(type_handle) { } /** * */ template INLINE typename PointerToArray::iterator PointerToArray:: begin() const { if ((this->_void_ptr) == nullptr) { return _empty_array.begin(); } return ((To *)(this->_void_ptr))->begin(); } /** * */ template INLINE typename PointerToArray::iterator PointerToArray:: end() const { if ((this->_void_ptr) == nullptr) { return _empty_array.begin(); } return ((To *)(this->_void_ptr))->end(); } /** * */ template INLINE typename PointerToArray::reverse_iterator PointerToArray:: rbegin() const { if ((this->_void_ptr) == nullptr) { return _empty_array.rbegin(); } return ((To *)(this->_void_ptr))->rbegin(); } /** * */ template INLINE typename PointerToArray::reverse_iterator PointerToArray:: rend() const { if ((this->_void_ptr) == nullptr) { return _empty_array.rbegin(); } return ((To *)(this->_void_ptr))->rend(); } /** * */ template INLINE typename PointerToArray::size_type PointerToArray:: size() const { return ((this->_void_ptr) == nullptr) ? 0 : ((To *)(this->_void_ptr))->size(); } /** * */ template INLINE typename PointerToArray::size_type PointerToArray:: max_size() const { nassertd((this->_void_ptr) != nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } return ((To *)(this->_void_ptr))->max_size(); } /** * */ template INLINE bool PointerToArray:: empty() const { return ((this->_void_ptr) == nullptr) ? true : ((To *)(this->_void_ptr))->empty(); } /** * */ template INLINE void PointerToArray:: reserve(typename PointerToArray::size_type n) { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->reserve(n); } /** * */ template INLINE void PointerToArray:: resize(typename PointerToArray::size_type n) { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->resize(n); } /** * */ template INLINE typename PointerToArray::size_type PointerToArray:: capacity() const { nassertr((this->_void_ptr) != nullptr, 0); return ((To *)(this->_void_ptr))->capacity(); } /** * */ template INLINE typename PointerToArray::reference PointerToArray:: front() const { nassertd((this->_void_ptr) != nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertd(!((To *)(this->_void_ptr))->empty()) { ((To *)(this->_void_ptr))->push_back(Element()); } return ((To *)(this->_void_ptr))->front(); } /** * */ template INLINE typename PointerToArray::reference PointerToArray:: back() const { nassertd((this->_void_ptr) != nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertd(!((To *)(this->_void_ptr))->empty()) { ((To *)(this->_void_ptr))->push_back(Element()); } return ((To *)(this->_void_ptr))->back(); } /** * */ template INLINE typename PointerToArray::iterator PointerToArray:: insert(iterator position, const Element &x) { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); position = end(); } nassertr(position >= ((To *)(this->_void_ptr))->begin() && position <= ((To *)(this->_void_ptr))->end(), position); return ((To *)(this->_void_ptr))->insert(position, x); } /** * */ template INLINE void PointerToArray:: insert(iterator position, size_type n, const Element &x) { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); position = end(); } nassertv(position >= ((To *)(this->_void_ptr))->begin() && position <= ((To *)(this->_void_ptr))->end()); ((To *)(this->_void_ptr))->insert(position, n, x); } /** * */ template INLINE void PointerToArray:: erase(iterator position) { nassertv((this->_void_ptr) != nullptr); nassertv(position >= ((To *)(this->_void_ptr))->begin() && position <= ((To *)(this->_void_ptr))->end()); ((To *)(this->_void_ptr))->erase(position); } /** * */ template INLINE void PointerToArray:: erase(iterator first, iterator last) { nassertv((this->_void_ptr) != nullptr); nassertv(first >= ((To *)(this->_void_ptr))->begin() && first <= ((To *)(this->_void_ptr))->end()); nassertv(last >= ((To *)(this->_void_ptr))->begin() && last <= ((To *)(this->_void_ptr))->end()); ((To *)(this->_void_ptr))->erase(first, last); } #if !defined(WIN32_VC) && !defined(WIN64_VC) /** * */ template INLINE typename PointerToArray::reference PointerToArray:: operator [](size_type n) const { nassertd((this->_void_ptr) != nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertd(!((To *)(this->_void_ptr))->empty()) { ((To *)(this->_void_ptr))->push_back(Element()); } nassertr(n < ((To *)(this->_void_ptr))->size(), ((To *)(this->_void_ptr))->operator[](0)); return ((To *)(this->_void_ptr))->operator[](n); } /** * */ template INLINE typename PointerToArray::reference PointerToArray:: operator [](int n) const { return operator[]((size_type)n); } #endif /** * */ template INLINE void PointerToArray:: push_back(const Element &x) { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->push_back(x); } /** * */ template INLINE void PointerToArray:: pop_back() { nassertd((this->_void_ptr) != nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertv(!((To *)(this->_void_ptr))->empty()); ((To *)(this->_void_ptr))->pop_back(); } /** * Empties the array pointed to. This is different from clear(), which * reassigns the pointer to a NULL pointer. */ template INLINE void PointerToArray:: make_empty() { nassertd((this->_void_ptr) != nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertv(!((To *)(this->_void_ptr))->empty()); ((To *)(this->_void_ptr))->clear(); } /** * The pointer typecast operator is convenient for maintaining the fiction * that we actually have a C-style array. It returns the address of the first * element in the array, unless the pointer is unassigned, in which case it * returns NULL. */ template INLINE PointerToArray:: operator Element *() const { To *vec = (To *)(this->_void_ptr); return ((vec == nullptr)||(vec->empty())) ? nullptr : &(vec->front()); } /** * Function p() is similar to the function from PointerTo. It does the same * thing: it returns the same thing as the typecast operator, above. */ template INLINE Element *PointerToArray:: p() const { To *vec = (To *)(this->_void_ptr); return ((vec == nullptr)||(vec->empty())) ? nullptr : &(vec->front()); } /** * To access the vector itself, for more direct fiddling with some of the * vector's esoteric functionality. */ template INLINE pvector &PointerToArray:: v() const { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } return *((To *)(this->_void_ptr)); } /** * To access the internal ReferenceCountedVector object, for very low-level * fiddling. Know what you are doing! */ template INLINE ReferenceCountedVector *PointerToArray:: v0() const { return (To *)(this->_void_ptr); } /** * This method exists mainly to access the elements of the array easily from a * high-level language such as Python, especially on Windows, where the above * index element accessor methods can't be defined because of a confusion with * the pointer typecast operator. */ template INLINE const Element &PointerToArray:: get_element(size_type n) const { return (*this)[n]; } /** * This method exists mainly to access the elements of the array easily from a * high-level language such as Python, especially on Windows, where the above * index element accessor methods can't be defined because of a confusion with * the pointer typecast operator. */ template INLINE void PointerToArray:: set_element(size_type n, const Element &value) { nassertv(n < ((To *)(this->_void_ptr))->size()); (*this)[n] = value; } /** * This method exists mainly to access the data of the array easily from a * high-level language such as Python. * * It returns the entire contents of the vector as a block of raw data in a * string. */ template INLINE std::string PointerToArray:: get_data() const { return get_subdata(0, size()); } /** * This method exists mainly to access the data of the array easily from a * high-level language such as Python. * * It replaces the entire contents of the vector from a block of raw data in a * string. */ template INLINE void PointerToArray:: set_data(const std::string &data) { set_subdata(0, size(), data); } /** * This method exists mainly to access the data of the array easily from a * high-level language such as Python. * * It returns the contents of a portion of the vector--from element (n) * through element (n + count - 1)--as a block of raw data in a string. */ template INLINE std::string PointerToArray:: get_subdata(size_type n, size_type count) const { n = std::min(n, size()); count = std::max(count, n); count = std::min(count, size() - n); return std::string((const char *)(p() + n), sizeof(Element) * count); } /** * This method exists mainly to access the data of the array easily from a * high-level language such as Python. * * It replaces the contents of a portion of the vector--from element (n) * through element (n + count - 1)--as a block of raw data in a string. The * length of the string must be an even multiple of Element size bytes. The * array may be expanded or truncated if the length of the string does not * correspond to exactly count elements. */ template INLINE void PointerToArray:: set_subdata(size_type n, size_type count, const std::string &data) { nassertv((data.length() % sizeof(Element)) == 0); nassertv(n <= size() && n + count <= size()); if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } size_type ncount = data.length() / sizeof(Element); if (ncount < count) { // Reduce the array. erase(begin() + n + ncount, begin() + n + count); } else if (count < ncount) { // Expand the array. insert(begin() + n + count, ncount - count, Element()); } // Now boldly replace the data. Hope there aren't any constructors or // destructors involved here. The user better know what she is doing. memcpy(p() + n, data.data(), sizeof(Element) * ncount); } /** * Returns the reference to memory where the vector is stored. To be used * only with set_void_ptr */ template INLINE void *PointerToArray:: get_void_ptr() const { return (this->_void_ptr); } /** * Sets this PTA to point to the pointer passed in */ template INLINE void PointerToArray:: set_void_ptr(void *p) { ((PointerToArray *)this)->reassign((To *)p); } /** * Returns the reference count of the underlying vector. */ template INLINE int PointerToArray:: get_ref_count() const { return ((this->_void_ptr) == nullptr) ? 0 : ((To *)(this->_void_ptr))->get_ref_count(); } /** * Increments the reference count of the underlying vector. */ template INLINE void PointerToArray:: ref() const { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->ref(); } /** * Decrements the reference count of the underlying vector. */ template INLINE bool PointerToArray:: unref() const { nassertr((this->_void_ptr) != nullptr, true); return ((To *)(this->_void_ptr))->unref(); } /** * Returns the node_ref of the underlying vector. */ template INLINE int PointerToArray:: get_node_ref_count() const { return ((this->_void_ptr) == nullptr) ? 0 : ((To *)(this->_void_ptr))->get_node_ref_count(); } /** * Increments the node_ref of the underlying vector. */ template INLINE void PointerToArray:: node_ref() const { if ((this->_void_ptr) == nullptr) { ((PointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->node_ref(); } /** * Decrements the node_ref of the underlying vector. */ template INLINE bool PointerToArray:: node_unref() const { nassertr((this->_void_ptr) != nullptr, true); return ((To *)(this->_void_ptr))->node_unref(); } /** * Counts the frequency at which the given element occurs in the vector. */ template INLINE size_t PointerToArray:: count(const Element &value) const { if ((this->_void_ptr) != nullptr) { return std::count(begin(), end(), value); } else { return 0; } } /** * */ template INLINE PointerToArray &PointerToArray:: operator = (ReferenceCountedVector *ptr) { ((PointerToArray *)this)->reassign(ptr); return *this; } /** * */ template INLINE PointerToArray &PointerToArray:: operator = (const PointerToArray ©) { _type_handle = copy._type_handle; ((PointerToArray *)this)->reassign(copy); return *this; } /** * */ template INLINE PointerToArray &PointerToArray:: operator = (PointerToArray &&from) noexcept { _type_handle = from._type_handle; ((PointerToArray *)this)->reassign(std::move(from)); return *this; } /** * To empty the PTA, use the clear() method, since assignment to NULL is * problematic (given the ambiguity of the pointer type of NULL). */ template INLINE void PointerToArray:: clear() { ((PointerToArray *)this)->reassign(nullptr); } /** * */ template INLINE ConstPointerToArray:: ConstPointerToArray(TypeHandle type_handle) : PointerToArrayBase(nullptr), _type_handle(type_handle) { } /** * Initializes a ConstPointerToArray by copying existing elements. */ template INLINE ConstPointerToArray:: ConstPointerToArray(const Element *begin, const Element *end, TypeHandle type_handle) : PointerToArrayBase(new ReferenceCountedVector(begin, end, type_handle)), _type_handle(type_handle) { } /** * */ template INLINE ConstPointerToArray:: ConstPointerToArray(const PointerToArray ©) : PointerToArrayBase(copy), _type_handle(copy._type_handle) { } /** * */ template INLINE ConstPointerToArray:: ConstPointerToArray(const ConstPointerToArray ©) : PointerToArrayBase(copy), _type_handle(copy._type_handle) { } /** * */ template INLINE ConstPointerToArray:: ConstPointerToArray(PointerToArray &&from) noexcept : PointerToArrayBase(std::move(from)), _type_handle(from._type_handle) { } /** * */ template INLINE ConstPointerToArray:: ConstPointerToArray(ConstPointerToArray &&from) noexcept : PointerToArrayBase(std::move(from)), _type_handle(from._type_handle) { } /** * Initializes the PTA from a vector. */ template INLINE ConstPointerToArray:: ConstPointerToArray(pvector &&from, TypeHandle type_handle) : PointerToArrayBase(new ReferenceCountedVector(std::move(from))), _type_handle(type_handle) { } /** * */ template INLINE typename ConstPointerToArray::iterator ConstPointerToArray:: begin() const { if ((this->_void_ptr) == nullptr) { return _empty_array.begin(); } return ((To *)(this->_void_ptr))->begin(); } /** * */ template INLINE typename ConstPointerToArray::iterator ConstPointerToArray:: end() const { if ((this->_void_ptr) == nullptr) { return _empty_array.begin(); } return ((To *)(this->_void_ptr))->end(); } /** * */ template INLINE typename ConstPointerToArray::reverse_iterator ConstPointerToArray:: rbegin() const { if ((this->_void_ptr) == nullptr) { return _empty_array.rbegin(); } return ((To *)(this->_void_ptr))->rbegin(); } /** * */ template INLINE typename ConstPointerToArray::reverse_iterator ConstPointerToArray:: rend() const { if ((this->_void_ptr) == nullptr) { return _empty_array.rbegin(); } return ((To *)(this->_void_ptr))->rend(); } /** * */ template INLINE typename ConstPointerToArray::size_type ConstPointerToArray:: size() const { return ((this->_void_ptr) == nullptr) ? 0 : ((To *)(this->_void_ptr))->size(); } /** * */ template INLINE typename ConstPointerToArray::size_type ConstPointerToArray:: max_size() const { nassertd((this->_void_ptr) != nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } return ((To *)(this->_void_ptr))->max_size(); } /** * */ template INLINE bool ConstPointerToArray:: empty() const { return ((this->_void_ptr) == nullptr) ? true : ((To *)(this->_void_ptr))->empty(); } /** * */ template INLINE typename ConstPointerToArray::size_type ConstPointerToArray:: capacity() const { nassertd((this->_void_ptr) != nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } return ((To *)(this->_void_ptr))->capacity(); } /** * */ template INLINE typename ConstPointerToArray::reference ConstPointerToArray:: front() const { nassertd((this->_void_ptr) != nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertd(!((To *)(this->_void_ptr))->empty()) { ((To *)(this->_void_ptr))->push_back(Element()); } return ((To *)(this->_void_ptr))->front(); } /** * */ template INLINE typename ConstPointerToArray::reference ConstPointerToArray:: back() const { nassertd((this->_void_ptr) != nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertd(!((To *)(this->_void_ptr))->empty()) { ((To *)(this->_void_ptr))->push_back(Element()); } return ((To *)(this->_void_ptr))->back(); } #if !defined(WIN32_VC) && !defined(WIN64_VC) /** * */ template INLINE typename ConstPointerToArray::reference ConstPointerToArray:: operator [](size_type n) const { nassertd((this->_void_ptr) != nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } nassertd(!((To *)(this->_void_ptr))->empty()) { ((To *)(this->_void_ptr))->push_back(Element()); } nassertr(n < ((To *)(this->_void_ptr))->size(), ((To *)(this->_void_ptr))->operator[](0)); return ((To *)(this->_void_ptr))->operator[](n); } /** * */ template INLINE typename ConstPointerToArray::reference ConstPointerToArray:: operator [](int n) const { return operator[]((size_type)n); } #endif /** * The pointer typecast operator is convenient for maintaining the fiction * that we actually have a C-style array. It returns the address of the first * element in the array, unless the pointer is unassigned, in which case it * returns NULL. */ template INLINE ConstPointerToArray:: operator const Element *() const { const To *vec = (const To *)(this->_void_ptr); return ((vec == nullptr)||(vec->empty())) ? nullptr : &(vec->front()); } /** * Function p() is similar to the function from ConstPointerTo. It does the * same thing: it returns the same thing as the typecast operator, above. */ template INLINE const Element *ConstPointerToArray:: p() const { const To *vec = (const To *)(this->_void_ptr); return ((vec == nullptr)||(vec->empty())) ? nullptr : &(vec->front()); } /** * To access the vector itself, for more direct fiddling with some of the * vector's esoteric functionality. */ template INLINE const pvector &ConstPointerToArray:: v() const { nassertd((this->_void_ptr) != nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } return *(const To *)(this->_void_ptr); } /** * To access the internal ReferenceCountedVector object, for very low-level * fiddling. Know what you are doing! */ template INLINE const ReferenceCountedVector *ConstPointerToArray:: v0() const { return (const To *)(this->_void_ptr); } /** * Casts away the constness of the CPTA(Element), and returns an equivalent * PTA(Element). */ template INLINE PointerToArray ConstPointerToArray:: cast_non_const() const { PointerToArray non_const; non_const = (To *)(this->_void_ptr); return non_const; } /** * This method exists mainly to access the elements of the array easily from a * high-level language such as Python, especially on Windows, where the above * index element accessor methods can't be defined because of a confusion with * the pointer typecast operator. */ template INLINE const Element &ConstPointerToArray:: get_element(size_type n) const { return (*this)[n]; } /** * This method exists mainly to access the data of the array easily from a * high-level language such as Python. * * It returns the entire contents of the vector as a block of raw data in a * string. */ template INLINE std::string ConstPointerToArray:: get_data() const { return get_subdata(0, size()); } /** * This method exists mainly to access the data of the array easily from a * high-level language such as Python. * * It returns the contents of a portion of the vector--from element (n) * through element (n + count - 1)--as a block of raw data in a string. */ template INLINE std::string ConstPointerToArray:: get_subdata(size_type n, size_type count) const { n = std::min(n, size()); count = std::max(count, n); count = std::min(count, size() - n); return std::string((const char *)(p() + n), sizeof(Element) * count); } /** * Returns the reference count of the underlying vector. */ template INLINE int ConstPointerToArray:: get_ref_count() const { return ((this->_void_ptr) == nullptr) ? 0 : ((To *)(this->_void_ptr))->get_ref_count(); } /** * Increments the reference count of the underlying vector. */ template INLINE void ConstPointerToArray:: ref() const { if ((this->_void_ptr) == nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->ref(); } /** * Decrements the reference count of the underlying vector. */ template INLINE bool ConstPointerToArray:: unref() const { nassertr((this->_void_ptr) != nullptr, true); return ((To *)(this->_void_ptr))->unref(); } /** * Returns the node_ref of the underlying vector. */ template INLINE int ConstPointerToArray:: get_node_ref_count() const { return ((this->_void_ptr) == nullptr) ? 0 : ((To *)(this->_void_ptr))->get_node_ref_count(); } /** * Increments the node_ref of the underlying vector. */ template INLINE void ConstPointerToArray:: node_ref() const { if ((this->_void_ptr) == nullptr) { ((ConstPointerToArray *)this)->reassign(new ReferenceCountedVector(_type_handle)); } ((To *)(this->_void_ptr))->node_ref(); } /** * Decrements the node_ref of the underlying vector. */ template INLINE bool ConstPointerToArray:: node_unref() const { nassertr((this->_void_ptr) != nullptr, true); return ((To *)(this->_void_ptr))->node_unref(); } /** * Counts the frequency at which the given element occurs in the vector. */ template INLINE size_t ConstPointerToArray:: count(const Element &value) const { if ((this->_void_ptr) != nullptr) { return std::count(begin(), end(), value); } else { return 0; } } /** * */ template INLINE ConstPointerToArray &ConstPointerToArray:: operator = (ReferenceCountedVector *ptr) { ((ConstPointerToArray *)this)->reassign(ptr); return *this; } /** * */ template INLINE ConstPointerToArray &ConstPointerToArray:: operator = (const PointerToArray ©) { _type_handle = copy._type_handle; ((ConstPointerToArray *)this)->reassign(copy); return *this; } /** * */ template INLINE ConstPointerToArray &ConstPointerToArray:: operator = (const ConstPointerToArray ©) { _type_handle = copy._type_handle; ((ConstPointerToArray *)this)->reassign(copy); return *this; } /** * */ template INLINE ConstPointerToArray &ConstPointerToArray:: operator = (PointerToArray &&from) noexcept { _type_handle = from._type_handle; ((ConstPointerToArray *)this)->reassign(std::move(from)); return *this; } /** * */ template INLINE ConstPointerToArray &ConstPointerToArray:: operator = (ConstPointerToArray &&from) noexcept { _type_handle = from._type_handle; ((ConstPointerToArray *)this)->reassign(std::move(from)); return *this; } /** * To empty the PTA, use the clear() method, since assignment to NULL is * problematic (given the ambiguity of the pointer type of NULL). */ template INLINE void ConstPointerToArray:: clear() { ((ConstPointerToArray *)this)->reassign(nullptr); } #endif // CPPPARSER