Conversation
khva
reviewed
Feb 14, 2026
khva
reviewed
Feb 14, 2026
cpp/cpp_chapter_0151/text.md
Outdated
| *p = false; // Ошибка | ||
| p = nullptr; // Ошибка | ||
| ``` | ||
| Когда внутри функции создается вектор, переменная типа `std::vector` размещается в автоматической памяти (на стеке). Но у вектора есть приватное поле — _указатель_ на область в динамической памяти. Там и хранятся элементы. Объект вектора со всеми полями лежит на стеке, но одно из полей ссылается на динамическую память. И управление этой памятью реализовано в методах вектора. |
Collaborator
There was a problem hiding this comment.
Здесь не хватает подводки необходимости указателей. Просто идёт некоторая констатация фактов. Возможно читателю нужно задать вопрос: как он предполагает оперировать с динамической памятью? Вот есть много-много памяти и нужно разместить на ней объект. Наверное нужен механизм, который бы конструировал объект в куче. Ок сделали, а как мы будем обращаться к созданному объекту? Нужно что-то, что указывает на созданный объект. Указатель! Далее рассказать про new и delete.
Contributor
Author
There was a problem hiding this comment.
Добавила подводку. Про new и delete здесь рассказывать преждевременно.
khva
reviewed
Feb 14, 2026
khva
reviewed
Feb 14, 2026
4a2a65f to
f31b6a2
Compare
khva
reviewed
Feb 21, 2026
cpp/cpp_chapter_0151/text.md
Outdated
Comment on lines
121
to
122
| - Создавать объекты на куче и удалять их. | ||
| - Получать доступ к созданным объектам, чтобы читать их и модифицировать. |
Collaborator
There was a problem hiding this comment.
Лучше более подробно. Например:
- Выделить память под объект на куче.
- Получить доступ к выделенной памяти для создания, изменения и удаления объекта.
- Освободить память, когда объект удален.
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.