Function index

Add new function_index and along_index functions that do the same as function and along respectively, except they return the index instead of the value at the given index.

These functions are then used to implement contiguous optimizations and the erase function.