summaryrefslogtreecommitdiff
path: root/indra/llcommon/owning_ptr.h
AgeCommit message (Collapse)Author
2024-09-27Slightly streamline owning_ptr class definition.Nat Goodspeed
2024-09-27Introduce owning_ptr<T>; use it for JPEG2KEncode and JPEG2KDecode.Nat Goodspeed
owning_ptr<T> adapts std::unique_ptr<T> to be a better drop-in replacement for a legacy class that formerly stored plain T* data members, and explicitly destroyed them using domain-specific destructor functions. Directly substituting std::unique_ptr into JPEG2KEncode and JPEG2KDecode was cumbersome because every such pointer declaration required a redundant template parameter describing the deleter function passed into its constructor. Moreover, it required lots of little syntax tweaks: changing every assignment to a reset() call, changing every reference to a get() call. Using owning_ptr<T> allows us to leave the code more or less as it was before, save that assignment and destruction automatically handle the previous referenced T instance.