Is there any way to enforce that instances are only ever on the stack?
Disclaimer: ‘stack’ is not part of the c++ standard to my knowledge, there we have ASDVs (automatic storage duration variables). ABI might define stack. Note that sometimes these are passed in registers, which I believe is OK in your case. Define a CPS (continuation-passing style) factory method: class A { public: template<typename F, typename… Args> … Read more