Open
Conversation
18thday
commented
Jan 16, 2026
| std::vector<int> data_; | ||
| }; | ||
|
|
||
| void Stack::Push(const int value) { |
Contributor
Author
There was a problem hiding this comment.
константность лишняя, если не принимается по ссылке
18thday
commented
Jan 16, 2026
| // | ||
| RingBuffer(size_t size); | ||
| RingBuffer(size_t capacity, int value); | ||
| RingBuffer(const std::initializer_list<int> list); |
Contributor
Author
There was a problem hiding this comment.
const лишнее в данном случае
18thday
commented
Jan 16, 2026
| std::vector<int>::iterator begin_ = data_.begin(); | ||
| }; | ||
|
|
||
| RingBuffer::RingBuffer(size_t size) : data_(size + 1), size_(0), end_(data_.begin()), begin_(data_.begin()) { |
Contributor
Author
There was a problem hiding this comment.
а зачем размер увеличивать на единицу?
18thday
commented
Jan 16, 2026
| } | ||
| if(size_ != 1){ | ||
| begin_ = begin_ + 1 == data_.end() ? data_.begin() + 1 : begin_ + 1; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
часть кода можно не копироватьесли использовать TryPush
18thday
commented
Jan 16, 2026
| } | ||
| if(size_ != 1){ | ||
| begin_ = begin_ + 1 == data_.end() ? data_.begin() + 1 : begin_ + 1; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Как-то сложно получилось из-за необходимости постояннодобавлять вычитать 1
18thday
commented
Jan 16, 2026
| New.insert(New.begin(), 0); | ||
| New.resize(size + 1); | ||
| data_ = New; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.