More work on multidimensional Array class.
This commit is contained in:
		| @@ -27,50 +27,50 @@ namespace PolyVox | ||||
| { | ||||
| 	template <uint32_t noOfDims, typename ElementType> | ||||
| 	SubArray<noOfDims-1, ElementType> SubArray<noOfDims, ElementType>::operator[](uint32_t uIndex) | ||||
| 		{ | ||||
| 			assert(uIndex<m_pDimensions[0]); | ||||
| 			return | ||||
| 				SubArray<noOfDims-1, ElementType>(&m_pElements[uIndex*m_pOffsets[0]], | ||||
| 				m_pDimensions+1, m_pOffsets+1); | ||||
| 		} | ||||
| 	{ | ||||
| 		assert(uIndex<m_pDimensions[0]); | ||||
| 		return | ||||
| 			SubArray<noOfDims-1, ElementType>(&m_pElements[uIndex*m_pOffsets[0]], | ||||
| 			m_pDimensions+1, m_pOffsets+1); | ||||
| 	} | ||||
|  | ||||
| 		template <uint32_t noOfDims, typename ElementType> | ||||
| 		const SubArray<noOfDims-1, ElementType> SubArray<noOfDims, ElementType>::operator[](uint32_t uIndex) const | ||||
| 		{ | ||||
| 			assert(uIndex<m_pDimensions[0]); | ||||
| 			return | ||||
| 				SubArray<noOfDims-1, ElementType>(&m_pElements[uIndex*m_pOffsets[0]], | ||||
| 				m_pDimensions+1, m_pOffsets+1); | ||||
| 		} | ||||
| 	template <uint32_t noOfDims, typename ElementType> | ||||
| 	const SubArray<noOfDims-1, ElementType> SubArray<noOfDims, ElementType>::operator[](uint32_t uIndex) const | ||||
| 	{ | ||||
| 		assert(uIndex<m_pDimensions[0]); | ||||
| 		return | ||||
| 			SubArray<noOfDims-1, ElementType>(&m_pElements[uIndex*m_pOffsets[0]], | ||||
| 			m_pDimensions+1, m_pOffsets+1); | ||||
| 	} | ||||
|  | ||||
| 		template <uint32_t noOfDims, typename ElementType> | ||||
| 		SubArray<noOfDims, ElementType>::SubArray<noOfDims, ElementType>(ElementType * pElements, uint32_t * pDimensions, uint32_t * pOffsets) | ||||
| 			:m_pElements(pElements) | ||||
| 			,m_pDimensions(pDimensions) | ||||
| 			,m_pOffsets(pOffsets) | ||||
| 			,m_uNoOfElements(0) | ||||
| 		{ | ||||
| 		}  | ||||
| 	template <uint32_t noOfDims, typename ElementType> | ||||
| 	SubArray<noOfDims, ElementType>::SubArray<noOfDims, ElementType>(ElementType * pElements, uint32_t * pDimensions, uint32_t * pOffsets) | ||||
| 		:m_pElements(pElements) | ||||
| 		,m_pDimensions(pDimensions) | ||||
| 		,m_pOffsets(pOffsets) | ||||
| 		,m_uNoOfElements(0) | ||||
| 	{ | ||||
| 	}  | ||||
|  | ||||
|  | ||||
| 		template <typename ElementType> | ||||
| 		ElementType& SubArray<1, ElementType>::operator[] (uint32_t uIndex) | ||||
| 		{ | ||||
| 			assert(uIndex<m_pDimensions[0]); | ||||
| 			return m_pElements[uIndex]; | ||||
| 		} | ||||
| 	template <typename ElementType> | ||||
| 	ElementType& SubArray<1, ElementType>::operator[] (uint32_t uIndex) | ||||
| 	{ | ||||
| 		assert(uIndex<m_pDimensions[0]); | ||||
| 		return m_pElements[uIndex]; | ||||
| 	} | ||||
|  | ||||
| 		template <typename ElementType> | ||||
| 		const ElementType& SubArray<1, ElementType>::operator[] (uint32_t uIndex) const | ||||
| 		{ | ||||
| 			assert(uIndex<m_pDimensions[0]); | ||||
| 			return m_pElements[uIndex]; | ||||
| 		} | ||||
| 		 | ||||
| 		template <typename ElementType> | ||||
| 		SubArray<1, ElementType>::SubArray<1, ElementType>(ElementType * pElements, uint32_t * pDimensions, uint32_t * /*pOffsets*/) | ||||
| 			:m_pDimensions(pDimensions) | ||||
| 			,m_pElements(pElements)			 | ||||
| 		{ | ||||
| 		} | ||||
| 	template <typename ElementType> | ||||
| 	const ElementType& SubArray<1, ElementType>::operator[] (uint32_t uIndex) const | ||||
| 	{ | ||||
| 		assert(uIndex<m_pDimensions[0]); | ||||
| 		return m_pElements[uIndex]; | ||||
| 	} | ||||
|  | ||||
| 	template <typename ElementType> | ||||
| 	SubArray<1, ElementType>::SubArray<1, ElementType>(ElementType * pElements, uint32_t * pDimensions, uint32_t * /*pOffsets*/) | ||||
| 		:m_pDimensions(pDimensions) | ||||
| 		,m_pElements(pElements)			 | ||||
| 	{ | ||||
| 	} | ||||
| }//namespace PolyVox | ||||
		Reference in New Issue
	
	Block a user