@@ -121,7 +121,7 @@ namespace TreeTools {
121121 int32 *internal_label_ptr = nullptr ;
122122 std::vector<int32> leftmost_leaf;
123123 std::vector<int32> T;
124- int32* T_ptr = nullptr ;
124+ std:: size_t T_idx = 0 ;
125125 std::vector<int32> visited_nth;
126126 std::vector<ClusterRow> x_rows;
127127 // Dynamic bitset that uses stack allocation for small trees,
@@ -147,10 +147,8 @@ namespace TreeTools {
147147 }
148148
149149 inline void ENTER (int32 v, int32 w) noexcept {
150- *T_ptr = v;
151- ++T_ptr;
152- *T_ptr = w;
153- ++T_ptr;
150+ T[T_idx++] = v;
151+ T[T_idx++] = w;
154152 }
155153
156154 [[nodiscard]] inline int32 N () noexcept {
@@ -164,16 +162,16 @@ namespace TreeTools {
164162 inline void TRESET () noexcept {
165163 // This procedure prepares T for an enumeration of its entries,
166164 // beginning with the first entry.
167- T_ptr = T. data () ;
165+ T_idx = 0 ;
168166 }
169167
170168 inline void READT (int32 *v, int32 *w) {
171- *v = *T_ptr++ ;
172- *w = *T_ptr++ ;
169+ *v = T[T_idx++] ;
170+ *w = T[T_idx++] ;
173171 }
174172
175173 inline void NVERTEX (int32 *v, int32 *w) noexcept {
176- if (T_ptr != T. data () + Tlen) {
174+ if (T_idx != static_cast < size_t >( Tlen) ) {
177175 READT (v, w);
178176 v_j = *v;
179177 } else {
@@ -184,7 +182,7 @@ namespace TreeTools {
184182
185183 inline void NVERTEX_short (int32 *v, int32 *w) noexcept {
186184 // Don't count all-tips or all-ingroup: vertices 0, ROOT, Ingp.
187- if (T_ptr != T. data () + Tlen_short) {
185+ if (T_idx != static_cast < size_t >( Tlen_short) ) {
188186 READT (v, w);
189187 // v_j = *v; // Unneeded unless we go on to call LEFTLEAF
190188 } else {
@@ -214,7 +212,7 @@ namespace TreeTools {
214212 // This function procedure returns as its value the internal label
215213 // assigned to leaf v
216214 // MS note: input = v; output = X[v, 3]
217- return internal_label_ptr [v];
215+ return internal_label [v];
218216 }
219217
220218 inline int32 DECODE (const int32 internal_relabeling) noexcept {
@@ -402,7 +400,7 @@ namespace TreeTools {
402400 Tlen = 2 * n_vertex;
403401 Tlen_short = Tlen - (2 * 3 );
404402 T = std::vector<int32>(Tlen);
405- T_ptr = T. data () ;
403+ T_idx = 0 ;
406404
407405 resize_uninitialized (leftmost_leaf, n_vertex);
408406 resize_uninitialized (visited_nth, n_leaves);
0 commit comments