I think there's some misunderstanding of C++ concepts here. Your
member function doesn't need the
parameter. It's already a member function meaning it can only be called on an instance of
. You don't need to return the vector after you add to it either so
is not needed.
I'm sat looking at a class right now that is very similar
template < typename T >
unsigned int m_Length;
unsigned int m_Capacity;
To make use of this I would do something like:
CPodVector< double > APodVector;
double dTest = 3.14159265;
unsigned long ulIndex = 0;
bool bResult = APodVector.insert( 0, dTest );
functions that get called on the
instance would be the
function which are part of the ... above and go something like.
inline CPodVector() : m_pData(0), m_Length(0), m_Capacity(0)
bool insert( unsigned long ulIndex, const T& item )
if( m_Length == m_Capacity && !grow())
T* dst = m_pData + ulIndex;
memmove( dst + 1, dst, m_Length - ulIndex );
memcpy( dst, &item, sizeof(T) );
Of course this is a snippet from a specialist container, in general you should be using std::vector which is thoroughly tested and reliable and has good performance and documentation.