From a1b8ff188923692bb87307a5fb0676f1a328c9ed Mon Sep 17 00:00:00 2001 From: izikorgad Date: Mon, 3 Mar 2025 15:51:20 +0200 Subject: [PATCH 1/2] fix 07-find.cpp wrong output The output for set was wrong --- 07-strings-containers-and-views.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/07-strings-containers-and-views.md b/07-strings-containers-and-views.md index 516aa9f..a660e92 100644 --- a/07-strings-containers-and-views.md +++ b/07-strings-containers-and-views.md @@ -394,11 +394,11 @@ vector: 1 9 7 3 set: 3 4 6 8 Found in string at position: 2 Found in vector: 7 -Found in set: 4 +Found in set: 6 After: string: helo vector: 1 9 3 -set: 3 6 8 +set: 3 4 8 ``` Take time to study this program as it contains some important concepts: From 6c10fcafb5f3d27fd32c8f5d467320e5f0bb902d Mon Sep 17 00:00:00 2001 From: cpp-tutor Date: Tue, 11 Mar 2025 10:37:13 +0000 Subject: [PATCH 2/2] Improve descriptions of additional containers --- 07-strings-containers-and-views.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/07-strings-containers-and-views.md b/07-strings-containers-and-views.md index a660e92..b8fcfd5 100644 --- a/07-strings-containers-and-views.md +++ b/07-strings-containers-and-views.md @@ -693,15 +693,17 @@ There are some other containers and *container adaptors* implemented in the Stan * `std::bitset` also stores binary bits, but has its size fixed at compile-time -* `std::deque` (pronounced "deck") implements a double-ended FIFO similar to `std::vector` +* `std::deque` (pronounced "deck") implements a double-ended container similar to `std::vector`, but with additional operations such as `push_front()` -* `std::stack` implements a LIFO +* `std::stack` implements a LIFO (Last In First Out) -* `std::queue` implements a FIFO +* `std::queue` implements a FIFO (First In First Out) * `std::priority_queue` implements a FIFO that sorts by age and priority -* `std::flat_map` implements an unordered map essentially as two vectors +* `std::flat_set` implements a sorted container of unique values, typically implemented as a vector + +* `std::flat_map` implements a sorted associative container, typically implemented as two vectors (one for keys and one for values) A brief Tutorial such as this is not the place to delve into these, and indeed the other containers covered in this Chapter have much more detail to discover. As a go-to for both tutorial and reference I can highly recommend [CppReference.com](https://en.cppreference.com)[^1] and [Josuttis, "The C++ Standard Library"](http://cppstdlib.com)[^2].