Is there an efficient byte buffer queue?

John Burton john.burton at jbmail.com
Mon Oct 8 09:39:55 UTC 2018


My use case is sending data to a socket.

One part of my program generates blocks of bytes, and the socket 
part tries to send them to the socket and then removes from the 
queue the number that got sent.

I am currently using a byte[] and using concatenation and slicing 
to maintain the queue but this seems like it will do many 
unnecessary copies, allocations etc. than are needed. I would do 
much better to maintain a fixed size buffer and maintain read and 
write positions etc.

I'm happy to write my own fixed sized buffer queue for this, but 
just wanted to ask if there was anything in the standard library 
that could be used to do this so I'm not reinventing it all? I 
don't need thread safety for this case. (I know i could probably 
use vibe-d to implement my whole socket sender but don't want to 
in this case for .... reasons)


More information about the Digitalmars-d-learn mailing list