/*** Copyright (C) 2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved. File: AU_USING.hpp Date: 2024-07-30 Author: Reece ***/ #pragma once namespace __audetail { template struct __au_using { T_t *pThat; using CB_t = void (T_t:: *)(); CB_t cb; __au_using(T_t &that, CB_t cb) : cb(cb), pThat(&that) { } __au_using(T_t *that, CB_t cb) : cb(cb), pThat(that) { } ~__au_using() { ((pThat)->*(cb))(); } }; } #define AU_USING(pPointer, method) \ __audetail::__au_using>> AU_CONCAT(__stack_using, __COUNTER__)( \ pPointer, \ &AuRemovePointer_t>::method);