MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / Array

Class Array

Engine/lib/convexDecomp/NvHashMap.h:626–1114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624 */
625 template<class T, class Alloc = typename Internal::AllocatorTraits<T>::Type >
626 class Array : private Internal::ArrayMetaData<T>, private Alloc
627 {
628 typedef Internal::ArrayMetaData<T> MetaData;
629
630 using MetaData::mCapacity;
631 using MetaData::mData;
632 using MetaData::mSize;
633
634 public:
635
636 typedef T* Iterator;
637 typedef const T* ConstIterator;
638
639 /*!
640 Default array constructor. Initialize an empty array
641 */
642 NX_INLINE Array(const Alloc& alloc = Alloc()) : Alloc(alloc) {}
643
644 /*!
645 Initialize array with given length
646 */
647 NX_INLINE explicit Array(NxU32 capacity, const Alloc& alloc = Alloc())
648 : Alloc(alloc)
649 {
650 if(mCapacity>0)
651 allocate(mCapacity);
652 }
653
654 /*!
655 Copy-constructor. Copy all entries from other array
656 */
657 template <class A>
658 NX_INLINE Array(const Array<T,A>& other, const Alloc& alloc = Alloc())
659 {
660 if(other.mSize > 0)
661 {
662 mData = allocate(mSize = mCapacity = other.mSize);
663 copy(mData, other.mData, mSize);
664 }
665 }
666
667 /*!
668 Default destructor
669 */
670 NX_INLINE ~Array()
671 {
672 destroy(0, mSize);
673 if(mCapacity)
674 deallocate(mData);
675 }
676
677 /*!
678 Assignment operator. Copy content (deep-copy)
679 */
680 template <class A>
681 NX_INLINE const Array& operator= (const Array<T,A>& t)
682 {
683 if(&t == this)

Callers 3

jquery.jsFile · 0.50
GetArrayFunction · 0.50
GetArrayFunction · 0.50

Calls 3

allocateFunction · 0.85
NxMinFunction · 0.85
destroyFunction · 0.50

Tested by

no test coverage detected