// The lifetime of ATermRef can be derived from self since it is protected by self, so transmute 'static into 'a.
/// The invariant to uphold is that the resulting term MUST be inserted into the container. This is checked in debug mode, but not in release mode. If this invariant is violated, undefined behaviour may occur during garbage collection.