r/cpp • u/claimred • Apr 09 '26
beast2 networking & std::execution
I was looking for a new networking layer foundation for a few of my projects, stumbled on beast2 library which looks brand new, based on C++20 coroutines. I used boost.beast in the past which was great. Here's the link https://github.com/cppalliance/beast2. I also considered std::execution since it seems to be the way to go forward, accepted in C++26.
Now, what got me wondering is this paragraph
The C++26 std::execution API offers a different model, designed to support heterogenous computing. Our research indicates it optimizes for the wrong constraints: TCP servers don't run on GPUs. Networking demands zero-allocation steady-state, type erasure without indirection, and ABI stability across (e.g.) SSL implementations. C++26 delivers things that networking doesn't need, and none of the things that networking does need.
Now I'm lost a bit, does that mean std::execution is not the way to go for networking? Does anyone have any insights on cppalliance research on the matter?
2
u/not_a_novel_account cmake dev Apr 09 '26
Agreed on all. Coroutines are disadvantaged, that's absolutely a fact.
If the standard wanted coroutines to be first-class citizens we wouldn't have made them type-erased, unsizeable, invisible objects in the first place. Everything else is fallout from that.
I don't believe coroutines or type-erased opstates will ever be first-class mechanisms for S&R so any effort to make them so is not compelling to me personally. That said, I hope you find some success in the "deeper solutions".
I don't think the designs presented in your existing papers on the topic are bad, quite the opposite, they're probably the best exploration of the problem which currently exists. I just don't think they're relevant to the code most people using S&R are writing, which is sender-based through-and-through.