|
Boost : |
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2019-09-10 11:25:02
> On 10. Sep 2019, at 12:19, julien.blanc_at_tgcm.eu wrote:
>
> "Hans Dembinski via Boost" <boost_at_[hidden]> â 10 septembre 2019 11:07
>
>> This was probably discussed here before, but could someone remind me why
>> static_string and static_vector need to exist as separate containers at all?
>> Why don't we use a boost::vector and boost::string with a special allocator
>> that offers a fixed-sized memory pool allocated from the stack?
>
> This is how static_vector is implemented, afaik.
You are right,
https://www.boost.org/doc/libs/1_71_0/doc/html/boost/container/static_vector.html
It would be nice if dtl::static_vector_allocator was part of the public interface.
It seems that static_vector could just be an alias template in C++11.
> The main drawback is that it makes static_vector not trivially_copyable even for trivial T. I ended up reimplementing a custom static_vector for this reason only.
>
> I don't think it makes much sense to have a static_string which is not trivially copyable (which would probably be the case if using a specialization with an allocator).
That is an interesting point.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk