How can I design storage that conforms to the standard's implementation of std::any?
The standard working draft (n4582, 20.6.3, p.552) states the following suggestion for implementations of std::any : Implementations should avoid the use of dynamically allocated memory for a small contained object. [ Example: where the object constructed is holding only an int. —end example ] Such small-object optimization shall only be applied to types T for which is_nothrow_move_constructible_v is true. As far as I know, std::any can be easily implemented through type erasure/virtual functions and dynamically allocated memory. How can std::any avoid dynamic allocation and still destroy such