I know that std::string
has small-string optimization, and both std::any
and std::function
have small-object optimization.
Are these optimizations just implementation details, or are they specified in standard? If they're specified in standard, then which classes have small-object optimization?
I found some related words in spec:
22.7.4:Implementations should avoid the use of dynamically allocated memory for a small contained value. However, any such small-object optimization shall only be applied to types T for which is_nothrow_move_constructible_v is true.
But I can't find a specification for small-object optimization.
Any additional supplements and recommendations are appreciated.