Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer class is badly designed and superfluous #38

Open
klosworks opened this issue Jul 6, 2019 · 2 comments
Open

Buffer class is badly designed and superfluous #38

klosworks opened this issue Jul 6, 2019 · 2 comments

Comments

@klosworks
Copy link

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
Copy link
Owner

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants