On Fri, Aug 20, 2021, 14:24 Viktor Sehr via Boost
I just discovered basic_any which is a very nice addition for me. However it's a bit under-documented for the moment.
Thanks! Glad to hear that. It's quite hard to write a good docs, I'd appreciate help. Feel free to provide PRs to adjust the docs https://github.com/boostorg/any/blob/b4d7770db49979bfc22bdeb4c8e7ca1a39ad1e3...
For example: - I assume it's stack-allocated, does it allocate on the heap if assigned an object larger than the stack (like small_vector) or is this not allowed (like static_vector)?
Yes, it allocates on the heap if the object does not fit. It's documented here, somewhere between the lines https://www.boost.org/doc/libs/1_77_0/doc/html/boost/anys/basic_any.html - An idea would also be to add a flag which breaks compilation if an object
larger than the OptimizeForSize argument is assigned?
Good idea. Please fill a feature request https://github.com/boostorg/any/issues - (For detail) If allocated on the stack, are the first bytes of the
basic_any the same as the contained object?
No. For what were you planning to rely on that? /Viktor
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost