Added missing asserts for seq.index() < capacity_ and unified their usage based on has_element(). (#781)

* Added missing asserts for seq.index() < capacity_ and unified their usage based on its implemention in has_element().

* Removed an accidentaly added assert.