From b0b5680d53934b6d4277475a53029b9ae1376591 Mon Sep 17 00:00:00 2001
From: Marcus Mohr <marcus.mohr@lmu.de>
Date: Tue, 30 Nov 2021 16:30:24 +0100
Subject: [PATCH] Renames STL notebooks and updates the second one.

---
 ...ipynb => 06_STL_Sequence_Containers.ipynb} |  0
 ....ipynb => 07_STL_Set+Map+Algorithms.ipynb} | 80 ++++++++++++-------
 2 files changed, 51 insertions(+), 29 deletions(-)
 rename notebooks/{06_STL.ipynb => 06_STL_Sequence_Containers.ipynb} (100%)
 rename notebooks/{07_STL_part2.ipynb => 07_STL_Set+Map+Algorithms.ipynb} (93%)

diff --git a/notebooks/06_STL.ipynb b/notebooks/06_STL_Sequence_Containers.ipynb
similarity index 100%
rename from notebooks/06_STL.ipynb
rename to notebooks/06_STL_Sequence_Containers.ipynb
diff --git a/notebooks/07_STL_part2.ipynb b/notebooks/07_STL_Set+Map+Algorithms.ipynb
similarity index 93%
rename from notebooks/07_STL_part2.ipynb
rename to notebooks/07_STL_Set+Map+Algorithms.ipynb
index 4d6b127..a284797 100644
--- a/notebooks/07_STL_part2.ipynb
+++ b/notebooks/07_STL_Set+Map+Algorithms.ipynb
@@ -84,7 +84,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "a84d9620",
+   "id": "51fd5597",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -110,10 +110,18 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 1,
    "id": "e8c29594",
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Overwriting demo.cpp\n"
+     ]
+    }
+   ],
    "source": [
     "%%file demo.cpp\n",
     "\n",
@@ -150,6 +158,10 @@
     "    // decltype returns the type of an expression\n",
     "    std::set< myPair, decltype( cmp )* > pairs ( cmp );\n",
     "\n",
+    "    // alternatively we could do it ourselves; note that the (*) is important!\n",
+    "    // but that way is not very C++-ish\n",
+    "    // std::set< myPair, bool (*)( const myPair&, const myPair& ) > pairs( cmp );\n",
+    "    \n",
     "    // now insertion will work\n",
     "    pairs.insert( p1 );\n",
     "    pairs.insert( p2 );\n",
@@ -160,7 +172,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "id": "0a0207dd",
    "metadata": {},
    "outputs": [],
@@ -170,10 +182,20 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 3,
    "id": "68e1df4b",
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "p1 < p2 is 1\n",
+      "p2 < p1 is 0\n",
+      "insertion successful\n"
+     ]
+    }
+   ],
    "source": [
     "!./a.out"
    ]
@@ -284,7 +306,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "a942d3bd",
+   "id": "fb3ef7bb",
    "metadata": {},
    "source": [
     "Return to our example with the traffic light. Assume that we want to print the currect state of a specific traffic light. How to do that?\n",
@@ -333,7 +355,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "5847cc0d",
+   "id": "76c8886d",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -343,7 +365,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "6a1163c9",
+   "id": "731e7c94",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -352,7 +374,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "e5b29324",
+   "id": "08b68b2b",
    "metadata": {},
    "source": [
     "Another (neater) way is to associate the state with a corresponding string"
@@ -361,7 +383,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "e020ca91",
+   "id": "8fe484bf",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -387,7 +409,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "03890f8b",
+   "id": "74251bd8",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -397,7 +419,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "bfd20e03",
+   "id": "5b919ca3",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -406,7 +428,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "2919cfda",
+   "id": "b1718cdd",
    "metadata": {},
    "source": [
     "Another example, demonstrating additional features of ```std::map``` (converted from Gottschling, *Forschung mit modernem C++*)"
@@ -415,7 +437,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "e46017ba",
+   "id": "52f631d4",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -463,7 +485,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "c6102380",
+   "id": "aaba61ba",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -473,7 +495,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "2d71c79e",
+   "id": "3f9362c9",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -482,7 +504,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "26214da5",
+   "id": "a7e8490c",
    "metadata": {},
    "source": [
     "**Note:**  \n",
@@ -491,7 +513,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "afd6c8a0",
+   "id": "2032e7f2",
    "metadata": {},
    "source": [
     "#### Algorithm\n",
@@ -503,7 +525,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "fe55e848",
+   "id": "4c239bfa",
    "metadata": {},
    "source": [
     "**Example 1:** Remove double entries from a sequence"
@@ -512,7 +534,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "a307aade",
+   "id": "aed454ce",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -549,7 +571,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "f2e2c4d5",
+   "id": "57c92377",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -559,7 +581,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "b90a9b8a",
+   "id": "b190c1c6",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -568,7 +590,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "f52ee84c",
+   "id": "e9140c15",
    "metadata": {},
    "source": [
     "**Note:**\n",
@@ -583,7 +605,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "e435d1ec",
+   "id": "7856aa32",
    "metadata": {},
    "source": [
     "***\n",
@@ -595,7 +617,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "ecfa4c0a",
+   "id": "bed09ecd",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -639,7 +661,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "c9c3cb86",
+   "id": "16a6d2e8",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -649,7 +671,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "499d6af6",
+   "id": "015eb80f",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -659,7 +681,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "dc2715fd",
+   "id": "1efec163",
    "metadata": {},
    "outputs": [],
    "source": []
-- 
GitLab