Merci de ta réponse !
J'ai bien compris tout ça, le vrai problème est le code ! J'ai un exemple de proto a suivre :
class StackAllocator
{
public :
// Construct the allocator
explicit StackAllocator ( u64 size ) ;
// Get a marker to the current top
u64 getMarker ( ) ;
// Allocates a new block from the top
void∗ alloc ( u64 size ) ;
// Rolls the stack back to a previous marker
void freeToMarker ( u64 marker ) ;
// Clear the whole stack
void clear ( ) ;
};
Si je comprend bien le code attendu, je dois faire un tableau de ma classe StackAllocator comme ca :
private:
MaClass *tab;
Puis dans le constructeur le remplir comme ca?
tab=(MaClass *)malloc(sizeof(MaClass )*size);
Ou c'est pas du tout les mallocs sur les classes qu'il faut utiliser ici ?