If you're trying to add a new hash to the end of an array, then NetWallah's preferred solution is probably the right one
If you're always adding a new element to the array, I'd suggest a third solution, so you don't need to worry about the current size of the array:
Update: Must stop skimming ... didn't see both code lines on NetWallah's response.
In reply to Re^3: adding an element to AoH
by jhourcle
in thread adding an element to AoH
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |