I’ve got another set of changes which move script, witness, input, output and transaction storage to shared_ptr, and a template for deriving their collections from std::vector, along with a template-defined ::ptr for the collection itself. These collection objects can be specialized to provide collection queries (such as obtaining the set of tx hashes), which will move a lot of code out of the primary objects.
(edited)