MCPcopy Create free account
hub / github.com/anjo76/angelscript / CIntArrayArray

Class CIntArrayArray

sdk/tests/test_feature/source/test_arrayobject.cpp:84–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84class CIntArrayArray
85{
86public:
87 CIntArrayArray()
88 {
89 length = 0;
90 buffer = new CIntArray[0];
91 }
92 CIntArrayArray(int l)
93 {
94 length=l;
95 buffer = new CIntArray[l];
96 }
97 CIntArrayArray(const CIntArrayArray &other)
98 {
99 length = other.length;
100 buffer = new CIntArray[length];
101 for( int n = 0; n < length; n++ )
102 buffer[n] = other.buffer[n];
103 }
104 ~CIntArrayArray()
105 {
106 delete[] buffer;
107 }
108
109 CIntArrayArray &operator=(CIntArrayArray &other)
110 {
111 delete[] buffer;
112 length = other.length;
113 buffer = new CIntArray[length];
114 for( int n = 0; n < length; n++ )
115 buffer[n] = other.buffer[n];
116 return *this;
117 }
118
119 int size() {return length;}
120 void push_back(CIntArray &v)
121 {
122 CIntArray *b = new CIntArray[length+1];
123 for( int n = 0; n < length; n++ )
124 b[n] = buffer[n];
125 delete[] buffer;
126 buffer = b;
127 b[length++] = v;
128 }
129 CIntArray pop_back()
130 {
131 return buffer[--length];
132 }
133 CIntArray &operator[](int i)
134 {
135 return buffer[i];
136 }
137
138 int length;
139 CIntArray *buffer;
140};
141

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected