1. Replace ordered_non_unique indexes with composite keys / ordered_unique, using object_id as tiebreaker.
2. Make some casts more explicit.
This commit was rebased by theoreticalbts due to conflicts with the patches for #466#562 including bugfixes
- Fix flipped comparison operator
- Implement operator> and operator!= for object_id_type