11 Comments
User's avatar
Eelis's avatar

In the "Must allocate to combine buffer sequences" example, if you already know you have 2 HeaderBuffers and 3 BodyBuffers, then you can avoid allocation by just using std::array or std::inplace_vector instead of std::vector.

Vinnie's avatar

Right, if the length (number of elements) is known at compile time then they can be combined into a new type without allocation.

Eelis's avatar

To what extent is the "Type-level composition - no runtime allocation" example able to avoid allocation if the lengths are not known at compile time?

If send() ultimately needs to make an array of iovec, then if it doesn't know at compile-time how many it'll need to make, won't it have to do an allocation?

Eelis's avatar

Thanks, that makes a lot of sense.

I wonder whether an interface is technically possible that would let a user who happens to have an array<span<byte>, N> where N > boost::corosio::detail::max_iovec_ pass that to send() in a way that avoids allocation.

Borislav Grebenar's avatar

Nice and clear! Thanks!

User's avatar
Comment removed
Jan 25
Comment removed
Vinnie's avatar

Thanks. Can you believe the entire paper was AI-generated? Anyway... I've been building the successor to Boost.Asio (https://github.com/cppalliance/corosio) and I struggled for a while because on the one hand I like the compositional power of concepts but on the other hand I have grown to dislike header-only libraries which are template-only. I think I found the right balance now :)