cpp wrapper for array based index

added a unit test for testing the cpp wrapper