NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
class_arrays.hpp
Go to the documentation of this file.
1#pragma once
2#include <types.h>
4
5typedef void (*ctorPtr)(void *, int);
6typedef void (*dtorPtr)(void *, int);
7
11public:
20 __partial_array_destructor::__partial_array_destructor(void *pArray, u32 elSize, u32 elCount, dtorPtr pDtor) :
21 mpArray(pArray),
22 mSize(elSize),
23 mCount(elCount),
24 mpDtor(pDtor) {
26 }
27
31 if (mCurrNum < mCount && mpDtor) {
32 for (char *ptr = (char *)mpArray + mSize * mCurrNum; mCurrNum > 0; mCurrNum--) {
33 ptr -= mSize;
34 mpDtor(ptr, -1);
35 }
36 }
37 }
38
39 void *mpArray;
40 u32 mSize;
41 u32 mCount;
44};
Guarantees the correct destruction of an array if an exception is thrown during its construction.
void * mpArray
A pointer to the array memory.
u32 mCurrNum
The number of currently constructed array elements.
~__partial_array_destructor()
Destroys each array element in reverse order.
dtorPtr mpDtor
A pointer to the elements' default destructor.
u32 mSize
The size of one array element.
__partial_array_destructor(void *pArray, u32 elSize, u32 elCount, dtorPtr pDtor)
Creates a partial array destructor.
u32 mCount
The total number of array elements.
void(* dtorPtr)(void *, int)
Destructor function pointer.
void(* ctorPtr)(void *, int)
Constructor function pointer.