|
Boost : |
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2021-09-13 10:05:36
On Fri, Aug 20, 2021, 14:24 Viktor Sehr via Boost <boost_at_[hidden]>
wrote:
> 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/b4d7770db49979bfc22bdeb4c8e7ca1a39ad1e32/doc/any.xml#L592
>
> 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
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk