Skip to content

updated stl and templates#55

Open
cimbalistgleb-boop wants to merge 3 commits into
CPP-KT:masterfrom
cimbalistgleb-boop:master
Open

updated stl and templates#55
cimbalistgleb-boop wants to merge 3 commits into
CPP-KT:masterfrom
cimbalistgleb-boop:master

Conversation

@cimbalistgleb-boop

Copy link
Copy Markdown

No description provided.

updated info about contains and erase_if
…06.2026

Update 15_stl.md
updated info about contains and erase_if
updated info about NTTP
Comment thread src/14_templates.md
Comment on lines +213 to +219
В *C++20* нестатический шаблонный параметр может быть объявлен как auto, позволяя выводить тип из аргумента. Например:
```cpp
template <auto N> struct S {
static constexpr auto value = N;
};
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

непонятно что хотел сказать автор

Comment thread src/15_stl.md

В *C++20* ассоциативные контейнеры `(std::map, std::unordered_map, std::set, std::unordered_set)` получили метод `contains(key)`, который возвращает `bool`, проверяя наличие ключа. Это удобнее и читаемее, чем `count(key) > 0` или `find(key) != end()`.

Начиная с *C++20*, для всех контейнеров появилась функция `std::erase_if`. Например, std::erase_if(v, pred); выполняет удаление за один вызов, что проще, чем комбинация `remove_if + erase`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::erase_if(v, pred); стоит сделать моноширинным

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

Successfully merging this pull request may close these issues.

2 participants