Вот что у меня получилось :
Код: Выделить всё
template <typename Type> class CLargeData
{
private:
Type* m_ptr;
int m_size;
public:
void Display()
{
for( int i = 0; i < m_size; i++ )
{
cout << m_ptr[ i ];
}
cout << endl;
}
Type* Pop( int pos )
{
Type* ptr = &m_ptr[ pos ];
return ptr;
}
void Push( Type* var, int pos )
{
int i = 0;
while( var[ i ] != NULL )
{
m_ptr[ pos ] = var[ i ];
i++;
pos++;
}
}
CLargeData ( int size )
{
m_size = size;
m_ptr = (Type*) VirtualAlloc( 0, m_size, MEM_COMMIT, PAGE_READWRITE );
cout << "constr" << endl;
}
~CLargeData ()
{
VirtualFree( m_ptr, m_size, MEM_RELEASE );
cout << "destr" << endl;
}
};