arun11299 / cpp-subprocess

Subprocessing with modern C++
Other
456 stars 90 forks source link

Buffer class is badly designed and superfluous #38

Open klosworks opened 5 years ago

klosworks commented 5 years ago

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.

arun11299 commented 5 years ago

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.

hyperxor commented 4 years ago

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