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

std::vector (ab)uses automatic storage

There is no limit on how much automatic storage any std API uses. They could all require 12 terabytes of stack space. However, that API only requires Cpp17DefaultInsertable, and your implementation creates an extra instance over what is required by the constructor. Unless it is gated behind detecting the object is trivially ctorable and copyable, … Read more

Why are the terms “automatic” and “dynamic” preferred over the terms “stack” and “heap” in C++ memory management?

Automatic tells me something about the lifetime of an object: specifically that it is bound automatically to the enclosing scope, and will be destroyed automatically when that scope exits. Dynamic tells me that the lifetime of an object is not controlled automatically by the compiler, but is under my direct control. Stack is an overloaded … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)