Answers
Newest first. When a later standard changes an answer, the article is updated in place and says what changed and since when.
Each answer names the standard it is written for: 111417202326
- Document
- Answers
- Answers
- 24, newest first
- Page
- 3 of 3
- Written by
- Miriam Castellanos
- Sections
- All eight
- Feed
- RSS
std::threadandstd::jthread: start, join and stop a threadStart a thread with
std::threadorstd::jthread(C++20): pass arguments withstd::ref, get a result, stop it with astop_token, and what a missed join prints.written for C++20
std::variantin C++:std::visit,std::getand the trapsCreate a
std::variant, read it withstd::get,get_iforstd::visit, catch the missing case a conversion hides, and see what it costs and when to skip it.written for C++17
std::vectorin C++: size, capacity, erase and reallocationstd::vectorsize against capacity, how each standard library grows it, what every member invalidates, and erase, find and sort, checked on four compilers.written for C++17
When to mark a move constructor noexcept in C++
Mark moves and swap noexcept when they cannot throw, or
std::vectorcopies where it could move. What is noexcept already, and how to check it at compile time.written for C++20