cpp-subprocess icon indicating copy to clipboard operation
cpp-subprocess copied to clipboard

Buffer class is badly designed and superfluous

Open klosworks opened this issue 5 years ago • 2 comments

The class Buffer has

  std::vector<char> buf;
  size_t length = 0;

This is a bad interface design because the length field duplicates the buf.size(). At what situations can those differ? Should they differ? It is not documented and unclear.

Furthermore, the class can (and arguably should) be replaced with std::string.

klosworks avatar Jul 06 '19 18:07 klosworks

Hehe...yeah I agree its pretty bad. The original idea was to have something like asio buffers which users can later customize....but that never happened. For now I will just change it to use just plain STL.

arun11299 avatar Jul 08 '19 10:07 arun11299

@klosworks @arun11299 It seems that std::string can be a good replacement for std::vector<char>. Do you agree with me?

hyperxor avatar Nov 23 '19 22:11 hyperxor