@@ -399,7 +399,7 @@ class MHArray
399
399
}
400
400
401
401
/* *
402
- * Returns the element in the MSArray
402
+ * Returns the last element in the MSArray
403
403
* @return the last element in the array
404
404
*/
405
405
inline const T& Back () const
@@ -408,14 +408,32 @@ class MHArray
408
408
}
409
409
410
410
/* *
411
- * Returns the element in the MSArray
411
+ * Returns the last element in the MSArray
412
412
* @return the last element in the array
413
413
*/
414
414
inline T& Back ()
415
415
{
416
416
return data[bitField.LeftMostBit () - 1 ];
417
417
}
418
418
419
+ /* *
420
+ * Returns the first element in the MSArray
421
+ * @return the first element in the array
422
+ */
423
+ inline const T& Front () const
424
+ {
425
+ return data[bitField.FirstSetBit () - 1 ];
426
+ }
427
+
428
+ /* *
429
+ * Returns the first element in the MSArray
430
+ * @return the first element in the array
431
+ */
432
+ inline T& Front ()
433
+ {
434
+ return data[bitField.FirstSetBit () - 1 ];
435
+ }
436
+
419
437
private:
420
438
421
439
// Private Constructors
@@ -449,6 +467,27 @@ class MHArray
449
467
450
468
// Functions
451
469
470
+ friend class MIter <MHArray<T>, T>;
471
+ friend class CMIter <MHArray<T>, T>;
472
+
473
+ /* *
474
+ * Returns the index of the first element of the array. Used primarily for iterators
475
+ * @return the index of the first element of the array
476
+ */
477
+ inline size_t GetFirstElementIdx ()
478
+ {
479
+ return bitField.FirstSetBit () - 1 ;
480
+ }
481
+
482
+ /* *
483
+ * Returns the index of the first element of the array. Used primarily for const iterators
484
+ * @return the index of the first element of the array
485
+ */
486
+ inline const size_t GetFirstElementIdx () const
487
+ {
488
+ return bitField.FirstSetBit () - 1 ;
489
+ }
490
+
452
491
/* *
453
492
* @brief Sets an element in the array to a corresponding value
454
493
* @param index the index to insert the element into
0 commit comments