<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Cpps on BadproG</title>
    <link>https://www.badprog.com/cpp/</link>
    <description>Recent content in Cpps on BadproG</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 22 Jun 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.badprog.com/cpp/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>C&#43;&#43; - NVIDIA CUDA - Using the compute_xy and sm_xy compile options to generate an executable</title>
      <link>https://www.badprog.com/c-nvidia-cuda-using-the-compute-xy-and-sm-xy-compile-options-to-generate-an-executable/</link>
      <pubDate>Wed, 22 Jun 2022 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-nvidia-cuda-using-the-compute-xy-and-sm-xy-compile-options-to-generate-an-executable/</guid>
      <description>&lt;p&gt;To use an &lt;strong&gt;NVIDIA GPU&lt;/strong&gt; (the graphic card processor) you need a CUDA &lt;strong&gt;driver&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;And if you want to compile a program for a GPU you&amp;rsquo;ll have to use the CUDA &lt;strong&gt;toolkit&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;re going to see how to compile your project in order to generate an executable able to function on all available NVIDIA GPU (past, present and future).&lt;/p&gt;
&lt;p&gt;By saying &amp;ldquo;all&amp;rdquo; we say not deprecated yet of course.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Mixing native OpenGL functions with Qt ones</title>
      <link>https://www.badprog.com/c-qt-framework-mixing-native-opengl-functions-with-qt-ones/</link>
      <pubDate>Fri, 20 May 2022 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-mixing-native-opengl-functions-with-qt-ones/</guid>
      <description>&lt;p&gt;Having the &lt;strong&gt;Qt Framework&lt;/strong&gt; as &lt;strong&gt;GUI&lt;/strong&gt; for &lt;strong&gt;OpenGL&lt;/strong&gt; can be helpful of course but sometimes it seems easier to use the native OpenGL functions directly.&lt;/p&gt;
&lt;p&gt;This is exactly what we are going to see in this tutorial by mixing Qt and native OpenGL functions.&lt;/p&gt;
&lt;h2 id=&#34;first-to-all&#34;&gt;First to all&lt;/h2&gt;
&lt;p&gt;For this tutorial recipe we are going to use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;2 different pairs of shaders (vertex and fragment)&lt;/li&gt;
&lt;li&gt;2 VAOs&lt;/li&gt;
&lt;li&gt;2 VBOs&lt;/li&gt;
&lt;li&gt;2 EBOs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Shaders will be placed in the &amp;ldquo;shader/&amp;rdquo; directory and other files directly at the root.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QOpenGLWidget to display a shape with lighting and normal vectors</title>
      <link>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-shape-with-lighting-and-normal-vectors/</link>
      <pubDate>Thu, 28 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-shape-with-lighting-and-normal-vectors/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Lighting&lt;/strong&gt; is certainly one of the most interesting effect that we can make with OpenGL.&lt;/p&gt;
&lt;p&gt;Combined with colors and normal vectors, lighting becomes visually realistic.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to draw a main shape (kind of a rectangular cube), another one inside the first one and a third representing our lighting source.&lt;/p&gt;
&lt;p&gt;We are also going to add normal vectors to these two shapes but with opposite directions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenCV - Hello world</title>
      <link>https://www.badprog.com/c-opencv-hello-world/</link>
      <pubDate>Tue, 12 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opencv-hello-world/</guid>
      <description>&lt;p&gt;In a previous &lt;a href=&#34;https://www.badprog.com/c-opencv-setting-up-with-visual-studio&#34;&gt;tutorial we set up OpenCV with Visual Studio&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This time we are going to make our first Hello world OpenCV project.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;Firs​t of all&lt;/h2&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;ll change the color model of our image.&lt;/p&gt;
&lt;p&gt;Choose an image with colors because we are going to change them into a grayscale model.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll be able to come back to the original image colors.&lt;/p&gt;
&lt;p&gt;To achieve this 2 keys will be used:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenCV - Setting up with Visual Studio</title>
      <link>https://www.badprog.com/c-opencv-setting-up-with-visual-studio/</link>
      <pubDate>Sun, 10 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opencv-setting-up-with-visual-studio/</guid>
      <description>&lt;p&gt;&lt;strong&gt;OpenCV&lt;/strong&gt; is an interesting library aimed to computer vision.&lt;/p&gt;
&lt;p&gt;But before playing with it, it&amp;rsquo;s necessary to set up your IDE.&lt;/p&gt;
&lt;p&gt;This IDE will be Visual Studio for this tutorial.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s start by downloading the OpenCV library from the official &lt;strong&gt;GitHub&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For this tutorial we&amp;rsquo;ll use the &lt;strong&gt;4.5.3&lt;/strong&gt; version:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/opencv/opencv/releases/tag/4.5.3&#34;&gt;https://github.com/opencv/opencv/releases/tag/4.5.3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the latest version, it should be there:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/opencv/opencv/releases&#34;&gt;https://github.com/opencv/opencv/releases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take the following file for our tutorial:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QOpenGLWidget to display a window for moving shapes with keyboard and mouse</title>
      <link>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-window-for-moving-shapes-with-keyboard-and-mouse/</link>
      <pubDate>Tue, 06 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-window-for-moving-shapes-with-keyboard-and-mouse/</guid>
      <description>&lt;p&gt;In the past tutorials about &lt;strong&gt;Qt&lt;/strong&gt; and &lt;strong&gt;OpenGL&lt;/strong&gt; we saw how to deal with some basic tasks.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this time something a bit more advanced with the &lt;strong&gt;QOpenGLWidget&lt;/strong&gt; class in order to display a scene from a window with a shape.&lt;/p&gt;
&lt;p&gt;This shape (a cube) can be &lt;strong&gt;rotated&lt;/strong&gt;, &lt;strong&gt;translated&lt;/strong&gt;, &lt;strong&gt;zoomed&lt;/strong&gt; with the &lt;strong&gt;keyboard&lt;/strong&gt; and the &lt;strong&gt;mouse&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I added some options to change this cube into a &lt;strong&gt;colored&lt;/strong&gt; or &lt;strong&gt;texured&lt;/strong&gt; shape directly from the GUI.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using OpenGL texture with index array</title>
      <link>https://www.badprog.com/c-qt-framework-using-opengl-texture-with-index-array/</link>
      <pubDate>Thu, 21 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-opengl-texture-with-index-array/</guid>
      <description>&lt;p&gt;Playing with &lt;strong&gt;colors&lt;/strong&gt; can be fun but what about &lt;strong&gt;textures&lt;/strong&gt;?&lt;/p&gt;
&lt;p&gt;What about something really realistic?&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;OpenGL&lt;/strong&gt; tutorial for &lt;strong&gt;Qt&lt;/strong&gt; we are going to apply a texture on our dear &lt;strong&gt;triangles&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Yes in OpenGL there are only triangles, no other kinds of shapes available but with some variations though (the famous &lt;strong&gt;primitives&lt;/strong&gt;).&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We are going to see how to create a &lt;strong&gt;struct&lt;/strong&gt; named &lt;strong&gt;StructVertex&lt;/strong&gt; to handle a &lt;strong&gt;vertex&lt;/strong&gt; and its &lt;strong&gt;texture&lt;/strong&gt; in one &lt;strong&gt;object&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using 1 OpenGL VAO and 2 VBOs with only 1 array for both position and color of each vertex</title>
      <link>https://www.badprog.com/c-qt-framework-using-1-opengl-vao-and-2-vbos-with-only-1-array-for-both-position-and-color-of-each/</link>
      <pubDate>Wed, 13 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-1-opengl-vao-and-2-vbos-with-only-1-array-for-both-position-and-color-of-each/</guid>
      <description>&lt;p&gt;As we saw, &lt;a href=&#34;https://www.badprog.com/c-qt-framework-using-opengl-vao-and-vbo-to-handle-2-different-objects-on-the-scene&#34;&gt;in the last tutorial about using a VAO and VBO to handle 2 different objects on the scene with OpenGL&lt;/a&gt;, it&amp;rsquo;s possible to have 2 arrays of vertex: one to manage the position and one to deal with the color.&lt;/p&gt;
&lt;p&gt;This time we are going to see how to handle it with only one array.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;It&amp;rsquo;s  an easy example with only 3 points on the screen and each one with one different color: &lt;strong&gt;red&lt;/strong&gt;, &lt;strong&gt;green&lt;/strong&gt; and &lt;strong&gt;blue&lt;/strong&gt; (the famous &lt;strong&gt;RGB&lt;/strong&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using OpenGL VAO and VBO to handle 2 different objects on the scene</title>
      <link>https://www.badprog.com/c-qt-framework-using-opengl-vao-and-vbo-to-handle-2-different-objects-on-the-scene/</link>
      <pubDate>Fri, 01 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-opengl-vao-and-vbo-to-handle-2-different-objects-on-the-scene/</guid>
      <description>&lt;p&gt;&lt;strong&gt;VAO&lt;/strong&gt; (Vertex Array Object) and &lt;strong&gt;VBO&lt;/strong&gt; (Vertex Buffer Object) were introduced to help programmers since &lt;strong&gt;OpenGL 3.0&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So it’s not a recent features but if you just started learning OpenGL it could be very complex to understand.&lt;/p&gt;
&lt;p&gt;Furthermore if you are learning OpenGL and want to use it with &lt;strong&gt;Qt&lt;/strong&gt; together, it becomes a real nightmare.&lt;/p&gt;
&lt;p&gt;So what are these vertex objects and how to use them to manage two different objects on the scene?&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Converting std::vector to Boost.Python Numpy ndarray</title>
      <link>https://www.badprog.com/c-boost-converting-stdvector-to-boost-python-numpy-ndarray/</link>
      <pubDate>Mon, 25 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-converting-stdvector-to-boost-python-numpy-ndarray/</guid>
      <description>&lt;p&gt;You have a &lt;strong&gt;C++ std::vector&lt;/strong&gt; and you want to convert it to a &lt;strong&gt;Boost.Python Numpy ndarray&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;But, once the ndarray got, you want to get back to the C++ array.&lt;/p&gt;
&lt;p&gt;How to do that?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Boost.Python tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt; and &lt;strong&gt;Boost&lt;/strong&gt; on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Using Boost.Python Numpy from_data()</title>
      <link>https://www.badprog.com/c-boost-using-boost-python-numpy-from-data/</link>
      <pubDate>Sun, 24 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-using-boost-python-numpy-from-data/</guid>
      <description>&lt;p&gt;If you are using &lt;strong&gt;Python&lt;/strong&gt; then &lt;strong&gt;NumPy&lt;/strong&gt; is quite interesting for manipulating &lt;strong&gt;arrays&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;But how do we do that with &lt;strong&gt;C++&lt;/strong&gt; and &lt;strong&gt;Boost.Python NumPy&lt;/strong&gt; extension?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this &lt;strong&gt;Windows&lt;/strong&gt; tutorial with an easy example of the &lt;strong&gt;from_data()&lt;/strong&gt; method.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt; and &lt;strong&gt;Boost&lt;/strong&gt; on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Building the Boost.Python NumPy extension as a library</title>
      <link>https://www.badprog.com/c-boost-building-the-boost-python-numpy-extension-as-a-library/</link>
      <pubDate>Tue, 19 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-building-the-boost-python-numpy-extension-as-a-library/</guid>
      <description>&lt;p&gt;If you are a scientist and interested in &lt;strong&gt;Python&lt;/strong&gt;, you certainly already know the &lt;strong&gt;NumPy&lt;/strong&gt; package.&lt;/p&gt;
&lt;p&gt;In this tutorial I&amp;rsquo;ll propose to explain how to install it on &lt;strong&gt;Windows&lt;/strong&gt; in order to be used with the &lt;strong&gt;Boost.Python&lt;/strong&gt; library.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll also make an Hello world example.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt; and &lt;strong&gt;Boost&lt;/strong&gt; on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Using Boost.Python library on Windows to create a DLL</title>
      <link>https://www.badprog.com/c-boost-using-boost-python-library-on-windows-to-create-a-dll/</link>
      <pubDate>Wed, 13 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-using-boost-python-library-on-windows-to-create-a-dll/</guid>
      <description>&lt;p&gt;Communication between 2 different language isn&amp;rsquo;t so easy.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s often possible to find libraries to help us achieve this behaviour.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this &lt;strong&gt;Boost.Python&lt;/strong&gt; tutorial for &lt;strong&gt;Windows&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install Python 3 and Boost on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Setting up on Windows 10</title>
      <link>https://www.badprog.com/c-boost-setting-up-on-windows-10/</link>
      <pubDate>Sun, 10 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-setting-up-on-windows-10/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Boost&lt;/strong&gt; libraries are some of the famous ones in the &lt;strong&gt;C++&lt;/strong&gt; world.&lt;/p&gt;
&lt;p&gt;They contain tons of functionalities but aren&amp;rsquo;t so easy to use or even understand.&lt;/p&gt;
&lt;p&gt;First things first, let&amp;rsquo;s try to install it in on our dear &lt;strong&gt;Windows 10&lt;/strong&gt; operating system (it should work as well on &lt;strong&gt;Windows 11&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;And test it with &lt;strong&gt;Visual Studio 2017&lt;/strong&gt; and  &lt;strong&gt;Visual Studio 2019&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Ready? Let&amp;rsquo;s do it in this Boost installation tutorial for Windows 10.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QStyledItemDelegate for displaying a QCheckBox in a QTableView</title>
      <link>https://www.badprog.com/c-qt-framework-using-qstyleditemdelegate-for-displaying-a-qcheckbox-in-a-qtableview/</link>
      <pubDate>Fri, 15 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qstyleditemdelegate-for-displaying-a-qcheckbox-in-a-qtableview/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.badprog.com/c-qt-framework-using-qabstractitemmodel-with-qtableview-and-qlistview&#34;&gt;Adding text and numbers in an QAbstractItemModel&lt;/a&gt; was the easy part of the Qt Model/View design.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going a bit further by adding a &lt;strong&gt;QCheckBox&lt;/strong&gt; directly on each item of a column.&lt;/p&gt;
&lt;p&gt;But instead of using the &lt;strong&gt;createEditor()&lt;/strong&gt; method we&amp;rsquo;re going to use only the &lt;strong&gt;paint()&lt;/strong&gt; one.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s painting.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this example adding a visual QObject is generally made with the createEditor() method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Windows - Creating a dynamic-link library (DLL)</title>
      <link>https://www.badprog.com/c-windows-creating-a-dynamic-link-library-dll/</link>
      <pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-windows-creating-a-dynamic-link-library-dll/</guid>
      <description>&lt;p&gt;Creating a &lt;strong&gt;.DLL&lt;/strong&gt; is an interesting process that allows a better comprehension how a &lt;strong&gt;dynamic-link library&lt;/strong&gt; works on Windows.&lt;/p&gt;
&lt;p&gt;No need to say that we&amp;rsquo;ll use Visual Studio for that.&lt;/p&gt;
&lt;p&gt;Ready to dynamic linking?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s link.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need of course Visual Studio 2017 but feel free to use the version of your choice.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;are going to create a dynamic-link library, at first, then create an application that&amp;rsquo;ll use this library.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QAbstractItemModel with QTableView and QListView</title>
      <link>https://www.badprog.com/c-qt-framework-using-qabstractitemmodel-with-qtableview-and-qlistview/</link>
      <pubDate>Mon, 11 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qabstractitemmodel-with-qtableview-and-qlistview/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;QAbstractItemModel&lt;/strong&gt; is usually used with views like &lt;strong&gt;QTableView&lt;/strong&gt;, &lt;strong&gt;QTreeView&lt;/strong&gt; or &lt;strong&gt;QListView&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We’re going to see how to use this class in a very easy example.&lt;/p&gt;
&lt;p&gt;To be honest nothing is easy but we’ll use the minimum elements in order to have something useful for every new project.&lt;/p&gt;
&lt;p&gt;Let’s see that in this QAbstractItemModel tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Model/View&lt;/strong&gt; design is quite different from the classic &lt;strong&gt;Widgets&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Indeed, here the view and the model are separated in at least two different classes.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QDataStream</title>
      <link>https://www.badprog.com/c-qt-framework-using-qdatastream/</link>
      <pubDate>Mon, 04 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qdatastream/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;QDataStream&lt;/strong&gt; class allows to stock data from an input and give back this data to an output.&lt;/p&gt;
&lt;p&gt;Quite interesting when you want, for example, to transfer data from a computer to another.&lt;/p&gt;
&lt;p&gt;Let’s see that in this QDataStream tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this tutorial we’re going to create a custom object (BadprogDS) and transfer it to another one.&lt;/p&gt;
&lt;p&gt;It’ll involve overload stream operators such as &amp;ldquo;&amp;laquo;&amp;rdquo; and &amp;ldquo;&amp;raquo;&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Visual Studio IDE - Sharing project property sheets on many projects</title>
      <link>https://www.badprog.com/c-visual-studio-ide-sharing-project-property-sheets-on-many-projects/</link>
      <pubDate>Wed, 09 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-visual-studio-ide-sharing-project-property-sheets-on-many-projects/</guid>
      <description>&lt;p&gt;What is really annoying is to do again and again the same task without having something new to do.&lt;/p&gt;
&lt;p&gt;Set a Visual Studio project is one of this thing that you would like to automatize.&lt;/p&gt;
&lt;p&gt;The property manager allows us to do this kind of mechanism.&lt;/p&gt;
&lt;p&gt;We, indeed, are going to see how to share configurations from many C++ projects.&lt;/p&gt;
&lt;p&gt;Let’s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Visual Studio IDE: &lt;a href=&#34;https://visualstudio.microsoft.com/&#34;&gt;https://visualstudio.microsoft.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let’s create a solution and 3 projects:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Command</title>
      <link>https://www.badprog.com/c-design-pattern-command/</link>
      <pubDate>Tue, 14 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-command/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Command&lt;/strong&gt; design pattern creates a list of objects on which we&amp;rsquo;re going to apply a generic method.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a bit unusal because an object will request a method as parameter.&lt;/p&gt;
&lt;p&gt;This makes the Command design pattern a versatile one but maybe not so easy to handle at first.&lt;/p&gt;
&lt;p&gt;Once again an interesting study case.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Command design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-command&#34;&gt;https://github.com/badprog/badprog-design-pattern-command&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are many ways to use this Command design pattern.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Memento</title>
      <link>https://www.badprog.com/c-design-pattern-memento/</link>
      <pubDate>Wed, 06 Jun 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-memento/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Memento&lt;/strong&gt; design pattern allows an object to retrieve last states of another object.&lt;/p&gt;
&lt;p&gt;This is used for example in the undo mechanism.&lt;/p&gt;
&lt;p&gt;So it&amp;rsquo;s a very interesting pattern that doesn&amp;rsquo;t use any interface.&lt;/p&gt;
&lt;p&gt;But instead it uses an opaque pointer in order to store old states of the main object.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Memento design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-memento&#34;&gt;https://github.com/badprog/badprog-design-pattern-memento&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This pattern may seem obscur at first glance and maybe you have some questions such as: Why do we have to use three classes to save states of an object?&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Strategy</title>
      <link>https://www.badprog.com/c-design-pattern-strategy/</link>
      <pubDate>Sun, 13 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-strategy/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Strategy&lt;/strong&gt; design pattern allows to change behaviour of a program depending on a context.&lt;/p&gt;
&lt;p&gt;It means that a single class can manage many others without knowing that those classes even exist.&lt;/p&gt;
&lt;p&gt;Interesting isn&amp;rsquo;t it?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Strategy design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-strategy&#34;&gt;https://github.com/badprog/badprog-design-pattern-strategy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this example we are going to use a &lt;strong&gt;Context&lt;/strong&gt; as a manager, an &lt;strong&gt;IStrategy&lt;/strong&gt; as interface, &lt;strong&gt;Strategy1&lt;/strong&gt; and &lt;strong&gt;Strategy2&lt;/strong&gt; as dashboards.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Proxy</title>
      <link>https://www.badprog.com/c-design-pattern-proxy/</link>
      <pubDate>Thu, 10 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-proxy/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Proxy&lt;/strong&gt; design pattern is in charge of managing another class.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s like a firewall that you cannot overstep.&lt;/p&gt;
&lt;p&gt;There are several reasons to use a Proxy instead of directly another class.&lt;/p&gt;
&lt;p&gt;For example it can check if a client accessing an object has permission to do that or it can substitute to this object until someone really needs it (in order to avoid useless memory loading).&lt;/p&gt;
&lt;p&gt;So it&amp;rsquo;s a more complex object than the real one.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Mediator</title>
      <link>https://www.badprog.com/c-design-pattern-mediator/</link>
      <pubDate>Tue, 08 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-mediator/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Mediator&lt;/strong&gt; design pattern allows to unlink objects from each other.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s like a manager that centralizes every action performed by a component in order to dispatch these events to all other objects that need to know information.&lt;/p&gt;
&lt;p&gt;It could be seen as a design pattern quite accessible in term of complexity.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try it in an example.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-mediator&#34;&gt;https://github.com/badprog/badprog-design-pattern-mediator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What&amp;rsquo;s interesting in this design pattern is that each Ship doesn&amp;rsquo;t know who are other Ships.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Standard library - move</title>
      <link>https://www.badprog.com/c-standard-library-move/</link>
      <pubDate>Sun, 29 Apr 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-standard-library-move/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;move&lt;/strong&gt; template function allows to change an object owner.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re not going to dive in the heart of the move semantics.&lt;/p&gt;
&lt;p&gt;Instead we&amp;rsquo;re going to see a really easy example of how it works.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this &lt;em&gt;move&lt;/em&gt; tutorial we&amp;rsquo;re going to create 3 Ships, check their memory address then pass them to a Manager in order to add them to the Manager list.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Decorator</title>
      <link>https://www.badprog.com/c-design-pattern-decorator/</link>
      <pubDate>Wed, 11 Apr 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-decorator/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Decorator&lt;/strong&gt; design pattern allows an object to be decorated in different ways not by inheriting from another class but by adding features directly to this object.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s main interest is to avoid multiplication of classes that would be almost the same as the main one.&lt;/p&gt;
&lt;p&gt;This design pattern has an interesting architecture even if not so easy to understand at first.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how this Decorator design pattern works.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Prototype</title>
      <link>https://www.badprog.com/c-design-pattern-prototype/</link>
      <pubDate>Thu, 05 Apr 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-prototype/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Prototype&lt;/strong&gt; design pattern is used in order to &lt;strong&gt;clone an object&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Main goal to prototype design pattern is to create new objects with default values.&lt;/p&gt;
&lt;p&gt;This cloning operation is actually a copy of an object and can be made with a shallow or a deep copy.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Prototype design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Find the complete code on &lt;strong&gt;GitHub&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-prototype&#34;&gt;https://github.com/badprog/badprog-design-pattern-prototype&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are two different ways to copy an object: &lt;strong&gt;shallow&lt;/strong&gt; and &lt;strong&gt;deep&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Factory method</title>
      <link>https://www.badprog.com/c-design-pattern-factory-method/</link>
      <pubDate>Sun, 04 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-factory-method/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Factory method&lt;/strong&gt; design pattern is a really helpful one and a great dive into the world of design patterns.&lt;/p&gt;
&lt;p&gt;In our example we are going to use an interface and some concrete classes.&lt;/p&gt;
&lt;p&gt;If by reading this you are still interested in the concept, let&amp;rsquo;s see the Factory method design pattern in this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-singleton-factory-method&#34;&gt;https://github.com/badprog/badprog-design-pattern-singleton-factory-method&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the following tutorial we are going to use an interface class called &lt;strong&gt;IShip&lt;/strong&gt; that three other classes will inherit: &lt;strong&gt;ShipTiny&lt;/strong&gt;, &lt;strong&gt;ShipNormal&lt;/strong&gt; and &lt;strong&gt;ShipEnormous&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Singleton</title>
      <link>https://www.badprog.com/c-design-pattern-singleton/</link>
      <pubDate>Wed, 14 Feb 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-singleton/</guid>
      <description>&lt;p&gt;This &lt;strong&gt;Singleton&lt;/strong&gt; design pattern is certainly the most known and maybe the most easiest to understand.&lt;/p&gt;
&lt;p&gt;Its goal is to guarantee that an object will be created only once through all the program.&lt;/p&gt;
&lt;p&gt;So this object has to be unique, can&amp;rsquo;t even be created twice nor copied and it must be accessible through the entire application.&lt;/p&gt;
&lt;p&gt;This is for example the case when you have a logging class that must be accessible by almost every class in your program.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Observer</title>
      <link>https://www.badprog.com/c-design-pattern-observer/</link>
      <pubDate>Wed, 31 Jan 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-observer/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Observer&lt;/strong&gt; design pattern allows an object (often called Subject) to inform other objects (Observers) that an event has occurred.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s particularly useful when you have data from a Subject but you don&amp;rsquo;t know how this data will be used by the Observers.&lt;/p&gt;
&lt;p&gt;For example, data from a Subject can be used to display a text in an Observer and a chart in another Observer (even if data is the same).&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - CMake - Setup with Cygwin</title>
      <link>https://www.badprog.com/c-cmake-setup-with-cygwin/</link>
      <pubDate>Fri, 18 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-cmake-setup-with-cygwin/</guid>
      <description>&lt;p&gt;There are many ways to create a &lt;strong&gt;Makefile&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to generate a Makefile with &lt;strong&gt;CMake&lt;/strong&gt; on Windows.&lt;/p&gt;
&lt;p&gt;Indeed, CMake is a complex but interesting tool that can generate native Makefiles for the compiler of your choice.&lt;/p&gt;
&lt;p&gt;But it&amp;rsquo;s not all, CMake can also create some useful project files, for a lot of IDE (such as Visual Studio or Eclipse for example) and almost every OS (like GNU/Linux, Windows, Mac, etc.).&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Set up projects to use the gtest library</title>
      <link>https://www.badprog.com/c-google-test-set-up-projects-to-use-the-gtest-library/</link>
      <pubDate>Thu, 10 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-set-up-projects-to-use-the-gtest-library/</guid>
      <description>&lt;p&gt;Creating a library for your Google Test framework is a good practise.&lt;/p&gt;
&lt;p&gt;It separates your main project, your library and your tests code.&lt;/p&gt;
&lt;p&gt;A great way to deal with your dev team and your test team.&lt;/p&gt;
&lt;p&gt;Visual Studio will be our IDE for this tutorial.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this tutorial we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio 2017 Community&lt;/strong&gt;: &lt;a href=&#34;https://www.visualstudio.com/downloads/&#34;&gt;https://www.visualstudio.com/downloads/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Test 1.8.0&lt;/strong&gt;: &lt;a href=&#34;https://github.com/google/googletest/releases&#34;&gt;https://github.com/google/googletest/releases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Google Test will be installed in this directory:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Generating the gtest.lib from gtest.sln with Visual Studio</title>
      <link>https://www.badprog.com/c-google-test-generating-the-gtest-lib-from-gtest-sln-with-visual-studio/</link>
      <pubDate>Mon, 07 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-generating-the-gtest-lib-from-gtest-sln-with-visual-studio/</guid>
      <description>&lt;p&gt;Google Test framework is provided with a solution already generated that we can use with Visual Studio.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s the &lt;strong&gt;gtest.sln&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;But to use it we have to accomplish some steps in order to having it working properly.&lt;/p&gt;
&lt;p&gt;This is what we will see in this Google Test tutorial.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this tutorial we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio 2017 Community&lt;/strong&gt;: &lt;a href=&#34;https://www.visualstudio.com/downloads/&#34;&gt;https://www.visualstudio.com/downloads/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Test 1.8.0&lt;/strong&gt;: &lt;a href=&#34;https://github.com/google/googletest/releases&#34;&gt;https://github.com/google/googletest/releases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Google Test will be installed in this directory:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Using a Makefile to generate tests</title>
      <link>https://www.badprog.com/c-google-test-using-a-makefile-to-generate-tests/</link>
      <pubDate>Sun, 06 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-using-a-makefile-to-generate-tests/</guid>
      <description>&lt;p&gt;After succeeded in accomplishing the &lt;a href=&#34;https://www.badprog.com/c-google-test-setup-visual-studio-by-hand&#34;&gt;Google Test setup by hand&lt;/a&gt; we are going to see how to use a Makefile to create our running tests.&lt;/p&gt;
&lt;p&gt;Of course, this time, we will use the &lt;strong&gt;Cygwin&lt;/strong&gt; CLI in order to create our tests example.&lt;/p&gt;
&lt;p&gt;So don&amp;rsquo;t wait anymore, let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this Google Test tutorial, we need some useful tools to create an example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Google Test&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cygwin&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;google-test&#34;&gt;Google Test&lt;/h3&gt;
&lt;p&gt;Of course, we need the Google Test framework.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Setup Visual Studio by hand</title>
      <link>https://www.badprog.com/c-google-test-setup-visual-studio-by-hand/</link>
      <pubDate>Thu, 03 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-setup-visual-studio-by-hand/</guid>
      <description>&lt;p&gt;Before playing with the Google Test library, it&amp;rsquo;s necessary to install it.&lt;/p&gt;
&lt;p&gt;This is what this tutorial is made of, a bunch of elements in order to set up it.&lt;/p&gt;
&lt;p&gt;In our example, we are going to use Visual Studio 2017, so on Windows, without any Command-Line Interface (CLI) nor the RUN_ALL_TESTS() macro.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Two tools are necessary to realise this Google Test tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Test&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;visual-studio&#34;&gt;Visual Studio&lt;/h3&gt;
&lt;p&gt;We admit you have already downloaded &lt;strong&gt;Visual Studio 2017&lt;/strong&gt;, but if not you can always do it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using Jenkins to generate an .EXE file</title>
      <link>https://www.badprog.com/c-qt-framework-using-jenkins-to-generate-an-exe-file/</link>
      <pubDate>Mon, 10 Jul 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-jenkins-to-generate-an-exe-file/</guid>
      <description>&lt;p&gt;In this tutorial we are going to see how to download a project directly on GitHub, generate makefiles of this project, compile it and copy several dynamic-link libraries from a directory to another one.&lt;/p&gt;
&lt;p&gt;And all that automatically!&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in this Jenkins setup for Qt on Windows with MinGW.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ll use one of my project that I already put on GitHub in order to use it as an example:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Moving a shape with arrow keys</title>
      <link>https://www.badprog.com/c-qt-framework-moving-a-shape-with-arrow-keys/</link>
      <pubDate>Wed, 14 Jun 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-moving-a-shape-with-arrow-keys/</guid>
      <description>&lt;p&gt;Playing with the keyboard is an interesting way of learning the Qt framework.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going see, indeed, how to use the arrow keys in order to move a shape.&lt;/p&gt;
&lt;p&gt;This shape is a circle, with only few properties to handle with.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this Qt example we are going to use an &lt;strong&gt;interface&lt;/strong&gt; to specify that our shape is &lt;strong&gt;movable&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll also define a constructor for this shape in order to set their useful properties.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Using the OR and LEFT SHIFT operators to retrieve the display mode with strings</title>
      <link>https://www.badprog.com/c-opengl-using-the-or-and-left-shift-operators-to-retrieve-the-display-mode-with-strings/</link>
      <pubDate>Sun, 30 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-using-the-or-and-left-shift-operators-to-retrieve-the-display-mode-with-strings/</guid>
      <description>&lt;p&gt;The following tutorial will show you how to exploit data taken from a binary variable.&lt;/p&gt;
&lt;p&gt;In order to explain it, we are going to use the &lt;strong&gt;GLUT OpenGL&lt;/strong&gt; library.&lt;/p&gt;
&lt;p&gt;The display mode uses indeed this kind of mechanism with the &lt;strong&gt;OR operator&lt;/strong&gt;, symbolized with the famous &lt;strong&gt;pipe: &amp;ldquo;|&amp;rdquo;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;And we&amp;rsquo;ll use the &lt;strong&gt;LEFT SHIFT operator &amp;ldquo;&amp;laquo;&amp;rdquo;&lt;/strong&gt; to check data.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s dive into these binary operators.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In the GLUT library there are defines in the &lt;strong&gt;freeglut_std.h&lt;/strong&gt; file such as &lt;strong&gt;GLUT_RBG, GLUT_INDEX, GLUT_DOUBLE, GLUT_DEPTH&lt;/strong&gt;, etc.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Checking the FreeGLUT, GLEW and OpenGL version</title>
      <link>https://www.badprog.com/c-opengl-checking-the-freeglut-glew-and-opengl-version/</link>
      <pubDate>Mon, 10 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-checking-the-freeglut-glew-and-opengl-version/</guid>
      <description>&lt;p&gt;First thing to deal with OpenGL is to know which version you have on your operating system.&lt;/p&gt;
&lt;p&gt;For this tutorial we will test it on Windows.&lt;/p&gt;
&lt;p&gt;And because we are testing the OpenGL version, we will also check what is the FreeGLUT and GLEW version.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;To create code for OpenGL 3.3, you have to have a graphic card that handles OpenGL 3.3.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t know which version you have, the code below will show you this.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Adding an icon to the executable with Visual Studio</title>
      <link>https://www.badprog.com/c-opengl-adding-an-icon-to-the-executable-with-visual-studio/</link>
      <pubDate>Sun, 02 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-adding-an-icon-to-the-executable-with-visual-studio/</guid>
      <description>&lt;p&gt;To have an executable file that seems professional, it&amp;rsquo;s necessary to have your own icon when someone launches your program.&lt;/p&gt;
&lt;p&gt;This tutorial could easily adapted to any application generated from Visual Studio on Windows.&lt;/p&gt;
&lt;p&gt;This icon is generally the logo of the software, game or application you created.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;h3 id=&#34;creating-an-ico-file&#34;&gt;Creating an ICO file&lt;/h3&gt;
&lt;p&gt;The icon for the program must be an ICO format.&lt;/p&gt;
&lt;p&gt;It means that the extension must be .ico, like for example &lt;strong&gt;icon.ico&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Setting up Visual Studio</title>
      <link>https://www.badprog.com/c-opengl-setting-up-visual-studio/</link>
      <pubDate>Sun, 26 Jul 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-setting-up-visual-studio/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Visual Studio&lt;/strong&gt; version for this tutorial will be the &lt;strong&gt;2017&lt;/strong&gt;(seems to work with the &lt;strong&gt;2015&lt;/strong&gt; and &lt;strong&gt;2019&lt;/strong&gt; as well).&lt;br&gt;
The &lt;strong&gt;glew&lt;/strong&gt; version will be the &lt;strong&gt;2.2.0&lt;/strong&gt;.&lt;br&gt;
The &lt;strong&gt;freeglut&lt;/strong&gt; version will be the &lt;strong&gt;3.0.0&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The glew library stands for &lt;strong&gt;GL&lt;/strong&gt; &lt;strong&gt;E&lt;/strong&gt; xtension &lt;strong&gt;W&lt;/strong&gt; rangler.&lt;/p&gt;
&lt;p&gt;At the end of this OpenGL tutorial you will be able to display a window with a white square displayed on a black background.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We are going to use the &lt;strong&gt;32-bit&lt;/strong&gt; or the &lt;strong&gt;64-bit&lt;/strong&gt; version.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Algorithm - Using min(), max(), minmax() functions</title>
      <link>https://www.badprog.com/c-algorithm-using-min-max-minmax-functions/</link>
      <pubDate>Sun, 31 May 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-algorithm-using-min-max-minmax-functions/</guid>
      <description>&lt;p&gt;To be precise, in this tutorial, we are going to see the &lt;strong&gt;min()&lt;/strong&gt;, &lt;strong&gt;max()&lt;/strong&gt;, &lt;strong&gt;minmax()&lt;/strong&gt;, &lt;strong&gt;min_element()&lt;/strong&gt;, &lt;strong&gt;max_element()&lt;/strong&gt; and &lt;strong&gt;minmax_element()&lt;/strong&gt; functions.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll have no excuse anymore to get the minimum and maximum value from an array or when comparing two variables.&lt;/p&gt;
&lt;p&gt;Oh by the way, two functions are taken from the C++ 11: minmax() and minmax_element().&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The minmax() is a unique function to retrieve min and max values from 2 values or from an entire array.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Using interface and abstract classes to compute the shape&#39;s area</title>
      <link>https://www.badprog.com/c-tips-n-tricks-using-interface-and-abstract-classes-to-compute-the-shape-s-area/</link>
      <pubDate>Sun, 04 Nov 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-using-interface-and-abstract-classes-to-compute-the-shape-s-area/</guid>
      <description>&lt;p&gt;You&amp;rsquo;re maybe wondering what are interface and abstract classes? That&amp;rsquo;s a good point.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;re going to see how to compute the area of a shape by declaring an array of undefined shapes.&lt;/p&gt;
&lt;p&gt;After this, we will be able to use this shape as an object with this kind of Factory design pattern.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how with this example of using interface and abstract classes in C++.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;First of all, let&amp;rsquo;s create two directories, one for the &lt;strong&gt;.hh&lt;/strong&gt; (headers) and the other for the &lt;strong&gt;.cpp&lt;/strong&gt; (bodies):&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Creating an object onto the stack and into the heap</title>
      <link>https://www.badprog.com/c-tips-n-tricks-creating-an-object-onto-the-stack-and-into-the-heap/</link>
      <pubDate>Fri, 26 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-creating-an-object-onto-the-stack-and-into-the-heap/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Stack&lt;/strong&gt; and &lt;strong&gt;heap&lt;/strong&gt; enable data management inside the memory.&lt;/p&gt;
&lt;p&gt;But some data are added onto the stack and the other into the heap.&lt;/p&gt;
&lt;p&gt;For the stack, there is a stack pointer that enables to catch the last data added onto the stack.&lt;/p&gt;
&lt;p&gt;It means that the last data added will be the first used by the program. We call that a &lt;strong&gt;LIFO&lt;/strong&gt; (last in, first out) system.&lt;/p&gt;
&lt;p&gt;For the heap, this is quite different. Indeed, data added into the heap are added randomly in the RAM by the OS.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Using glRotatef() to animate shapes</title>
      <link>https://www.badprog.com/c-opengl-using-glrotatef-to-animate-shapes/</link>
      <pubDate>Sat, 14 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-using-glrotatef-to-animate-shapes/</guid>
      <description>&lt;p&gt;Rotating a shape is fun, but rotating it with animation is really great.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this &lt;strong&gt;glRotatef()&lt;/strong&gt; tutorial for animating shapes on a window.&lt;/p&gt;
&lt;p&gt;Our shape is made up of 3 squares with 3 different colours:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the white&lt;/li&gt;
&lt;li&gt;the burgundy&lt;/li&gt;
&lt;li&gt;the green&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;maincpp&#34;&gt;main.cpp&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* main.cpp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;BadprogRotate.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Main
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; av[])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BadprogRotate go(&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;∾&lt;/span&gt;, av);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;badprogrotateh&#34;&gt;BadprogRotate.h&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* BadprogRotate.h
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef BADPROGROTATE_H_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BADPROGROTATE_H_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;GL/freeglut.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN_TITLE &amp;#34;Square rotation by BadproG! :D&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN_WIDTH 600
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN_HEIGHT 600
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN_POSITION_X 100
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN_POSITION_Y 100
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;BadprogRotate&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; GLfloat S_ANGLE;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BadprogRotate(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;av[]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;virtual&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;~&lt;/span&gt;BadprogRotate();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerDisplay&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerIdle&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerResize&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerMouse&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerKeyboard&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;unsigned&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* BADPROGROTATE_H_ */&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;badprogrotatecpp&#34;&gt;BadprogRotate.cpp&lt;/h2&gt;
&lt;p&gt;Add the &lt;strong&gt;unistd.h&lt;/strong&gt; file for &lt;strong&gt;Windows&lt;/strong&gt; OS in order to change &lt;strong&gt;usleep()&lt;/strong&gt; by &lt;strong&gt;Sleep()&lt;/strong&gt; in the following &lt;strong&gt;managerIdle()&lt;/strong&gt; method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Errors / Warnings - Cannot declare member function ‘static void MyClass::myMethod()’ to have static linkage [-fpermissive]</title>
      <link>https://www.badprog.com/c-errors-warnings-cannot-declare-member-function-static-void-myclassmymethod-to-have-static-linkage/</link>
      <pubDate>Thu, 12 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-errors-warnings-cannot-declare-member-function-static-void-myclassmymethod-to-have-static-linkage/</guid>
      <description>&lt;p&gt;In C++, we don&amp;rsquo;t need to specify the &lt;strong&gt;static&lt;/strong&gt; keyword in the declaration of the header and in the definition in the class.&lt;/p&gt;
&lt;p&gt;It means that this &lt;strong&gt;keyword&lt;/strong&gt; has to be added only in the &lt;strong&gt;header&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You probably know that using the static keyword means that the function is unique in program.&lt;br&gt;
So if you add static in the .h and in the .cpp, you will have like two methods with the same name.&lt;br&gt;
And the compiler won&amp;rsquo;t appreciate it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Creating an equilateral triangle</title>
      <link>https://www.badprog.com/c-opengl-creating-an-equilateral-triangle/</link>
      <pubDate>Sat, 07 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-creating-an-equilateral-triangle/</guid>
      <description>&lt;p&gt;You succeeded to &lt;a href=&#34;https://www.badprog.com/c-opengl-hello-world&#34;&gt;display a white square on a black background with OpenGL&lt;/a&gt;.&lt;br&gt;
Great.&lt;br&gt;
Let&amp;rsquo;s see now how to render an equilateral triangle and changing some data.&lt;/p&gt;
&lt;p&gt;In this example we are going to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;create a Makefile&lt;/li&gt;
&lt;li&gt;set the background color to purple&lt;/li&gt;
&lt;li&gt;set the drawing color to green (for the triangle)&lt;/li&gt;
&lt;li&gt;draw an equilateral triangle on the scene (thanks to the Pythagorean theorem)&lt;/li&gt;
&lt;li&gt;put this triangle in the middle of the window&lt;/li&gt;
&lt;li&gt;close the window by pressing the ESC key&lt;/li&gt;
&lt;li&gt;resize the window on the fly&lt;/li&gt;
&lt;li&gt;displaying the x and y of the mouse in the console during a mouse moving&lt;/li&gt;
&lt;li&gt;displaying the x and y of the mouse with the state (0 down and 1 up) and which button clicked&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All these things are basic to develop a program in OpenGL.&lt;br&gt;
It&amp;rsquo;s like a super &lt;em&gt;Hello World!&lt;/em&gt; tutorial.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Using glRotatef() to rotate around the X, Y and Z axis</title>
      <link>https://www.badprog.com/c-opengl-using-glrotatef-to-rotate-around-the-x-y-and-z-axis/</link>
      <pubDate>Mon, 04 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-using-glrotatef-to-rotate-around-the-x-y-and-z-axis/</guid>
      <description>&lt;p&gt;In this &lt;strong&gt;OpenGL 2.1&lt;/strong&gt; tutorial we are going to use the &lt;strong&gt;glRotatef()&lt;/strong&gt; method.&lt;/p&gt;
&lt;p&gt;This method is designed to rotate around the 3 axis: X, Y and Z.&lt;br&gt;
In the example below I will use a black background and draw 3 triangles.&lt;/p&gt;
&lt;p&gt;The green will rotate around the X axis.&lt;br&gt;
The blue will rotate around the Y axis.&lt;br&gt;
The red will rotate around the Z axis.&lt;/p&gt;
&lt;p&gt;To better understand it, we have to imagine an eye seeing a point.&lt;br&gt;
Now around this point all triangles will rotate.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Hello World!</title>
      <link>https://www.badprog.com/c-opengl-hello-world/</link>
      <pubDate>Thu, 03 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-hello-world/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/c-opengl-installation&#34;&gt;installing the OpenGL libraries&lt;/a&gt; on your system, you would definitely want to display something on the screen.&lt;/p&gt;
&lt;p&gt;You are right!&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s see this with an &lt;strong&gt;&lt;em&gt;Hello World!&lt;/em&gt; OpenGL 2.1&lt;/strong&gt; tutorial.&lt;/p&gt;
&lt;p&gt;This is really a basic code to display a window and saying: &amp;ldquo;Great I can do it&amp;rdquo;.&lt;br&gt;
Such basic that it seems C implementation (indeed we don&amp;rsquo;t have any class in this example).&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// badprog.com
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;displayMe&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glClear(GL_COLOR_BUFFER_BIT);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glBegin(GL_POLYGON);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glEnd();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glFlush();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; argc, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;**&lt;/span&gt; argv)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInit(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;argc, argv);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInitDisplayMode(GLUT_SINGLE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInitWindowSize(&lt;span style=&#34;color:#ae81ff&#34;&gt;300&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;300&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInitWindowPosition(&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutCreateWindow(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello world from Badprog.com :D&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutDisplayFunc(displayMe);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutMainLoop();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;compiling&#34;&gt;Compiling&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;g&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt; main.cpp &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;o lookAtThis &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;lglut ; .&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;lookAtThis
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result&lt;/h2&gt;
&lt;p&gt;A black window with a white square displayed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Installation</title>
      <link>https://www.badprog.com/c-opengl-installation/</link>
      <pubDate>Thu, 03 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-installation/</guid>
      <description>&lt;p&gt;For this first &lt;strong&gt;OpenGL&lt;/strong&gt; tutorial, we are going to see how to install OpenGL on &lt;strong&gt;GNU/Linux&lt;/strong&gt; and &lt;strong&gt;Windows&lt;/strong&gt; operating system.&lt;/p&gt;
&lt;p&gt;We need the OpenGL files, but also those from the &lt;strong&gt;GLU&lt;/strong&gt; and &lt;strong&gt;GLUT&lt;/strong&gt; for GNU/Linux and &lt;strong&gt;freeGLUT&lt;/strong&gt; for Windows.&lt;br&gt;
The last ones, GLU and GLUT are libraries that add functionnalities from the basic OpenGL.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;OpenGL&lt;/strong&gt; = &lt;strong&gt;O&lt;/strong&gt; pen &lt;strong&gt;G&lt;/strong&gt; raphics &lt;strong&gt;L&lt;/strong&gt; ibrary&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GLU&lt;/strong&gt; = &lt;strong&gt;G&lt;/strong&gt; raphic &lt;strong&gt;L&lt;/strong&gt; ibrary &lt;strong&gt;U&lt;/strong&gt; tility&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GLUT&lt;/strong&gt; = &lt;strong&gt;G&lt;/strong&gt; raphic &lt;strong&gt;L&lt;/strong&gt; ibrary &lt;strong&gt;U&lt;/strong&gt; tility &lt;strong&gt;T&lt;/strong&gt; oolkit&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;installing-opengl-on-gnulinux&#34;&gt;Installing OpenGL on GNU/Linux&lt;/h2&gt;
&lt;h3 id=&#34;fedora&#34;&gt;Fedora&lt;/h3&gt;
&lt;p&gt;If you do not have the &lt;strong&gt;glut.h&lt;/strong&gt; file in your &lt;strong&gt;/usr/include/GL/&lt;/strong&gt; directory, let&amp;rsquo;s install it with the following command on your favorite shell:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Using a list of pairs</title>
      <link>https://www.badprog.com/c-tips-n-tricks-using-a-list-of-pairs/</link>
      <pubDate>Wed, 11 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-using-a-list-of-pairs/</guid>
      <description>&lt;p&gt;The container &lt;strong&gt;list&lt;/strong&gt; may accept another container.&lt;br&gt;
For example a &lt;strong&gt;pair&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So we are trying to add pairs inside a list. It will become a list of pairs!&lt;/p&gt;
&lt;p&gt;In the snippet below, I&amp;rsquo;m using only one file.&lt;br&gt;
So just compile and execute it to see the result.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this by creating a list of pairs in this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;the-file&#34;&gt;The file&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* main.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;My&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;list &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; _container;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    My() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;My created.&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerManager();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;virtual&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;~&lt;/span&gt;My() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;My destroyed.&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerManager&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Size of _container = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.size() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerAddElement(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Gray&amp;#34;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerAddElement(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;William&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blue&amp;#34;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerAddElement(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Charles&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Green&amp;#34;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Size of _container = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.size() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerDisplayElements();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerUseFirstElement();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerDisplayElements();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerUseFirstElement();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerDisplayElements();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerAddElement&lt;/span&gt;(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair myPair) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Adding &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; and &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; in _container.&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.push_back(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(myPair.first, myPair.second));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerDisplayElements&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;list &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;::&lt;/span&gt;iterator it;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (it &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.begin(); it &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;it) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*it &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; k &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it).first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it).second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;First element in _container = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.front().first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.front().second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerUseFirstElement&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Pop!&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;_container.pop_front();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    My &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;my &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; My();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;delete&lt;/span&gt; my;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1337&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;My created.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Size of _container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt; and &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Gray&amp;#34;&lt;/span&gt; in _container.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;William&amp;#34;&lt;/span&gt; and &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blue&amp;#34;&lt;/span&gt; in _container.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Charles&amp;#34;&lt;/span&gt; and &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Green&amp;#34;&lt;/span&gt; in _container.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Size of _container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; John &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Gray
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; William &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Blue
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;First element in _container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; John &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Gray
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Pop&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; William &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Blue
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;First element in _container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; William &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Blue
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Pop&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;First element in _container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;My destroyed.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Well done! 🤩&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Algorithm - Using the for_each() function</title>
      <link>https://www.badprog.com/c-algorithm-using-the-for-each-function/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-algorithm-using-the-for-each-function/</guid>
      <description>&lt;p&gt;An example of how using the for_each() function.&lt;/p&gt;
&lt;p&gt;Notice that you can have the same result with an iterator, &lt;a href=&#34;https://www.badprog.com/c-stl-standard-template-library-using-the-vector-container&#34;&gt;here an example&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;myFunction&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; myInt)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;myInt = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myInt &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector myVector;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;iterator myIterator;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        myVector.push_back(i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVector.begin(); myIterator &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; myVector.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;myIterator)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            myVector.erase(myIterator);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            myVector.insert(myIterator,  &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;for_each(myVector.begin(), myVector.end(), myFunction);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Standard library - Using the pair container</title>
      <link>https://www.badprog.com/c-standard-library-using-the-pair-container/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-standard-library-using-the-pair-container/</guid>
      <description>&lt;p&gt;The pair container cannot be iterated.&lt;/p&gt;
&lt;p&gt;So we can use it for example to return a double value at the end of a function.&lt;/p&gt;
&lt;p&gt;In the snippet below we are going to use it to change the first and the second value.&lt;br&gt;
This, respectively with the pair.first and pair.second methods:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair myPair(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Id: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - Name: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;38&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;William&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Id: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - Name: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - STL (Standard Template Library) - Using the queue container</title>
      <link>https://www.badprog.com/c-stl-standard-template-library-using-the-queue-container/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-stl-standard-template-library-using-the-queue-container/</guid>
      <description>&lt;p&gt;We are going to see in this queue tutorial, how to use it.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it with this first snippet.&lt;br&gt;
In the easy example below, we add 10 elements in the queue before displaying its content.&lt;br&gt;
We have to notice that we cannot iterate through a queue.&lt;/p&gt;
&lt;p&gt;So we have to use the couple queue.front() and queue.pop() to loop inside the queue.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;queue myQueue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myQueue.push(i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Size of the queue: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.size() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;First element of the queue: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.front() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Last element of the queue: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.back() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;myQueue.empty())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.front() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myQueue.pop();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - STL (Standard Template Library) - Using the vector container</title>
      <link>https://www.badprog.com/c-stl-standard-template-library-using-the-vector-container/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-stl-standard-template-library-using-the-vector-container/</guid>
      <description>&lt;p&gt;The vector container is the most classic STL container.&lt;/p&gt;
&lt;p&gt;In the snippet below, I can iterate through the vector, so I use an iterator to erase an element of the vector.&lt;br&gt;
In our case, I removed the number 2 from the container and I added 80 to this place.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this example of the vector container.&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector myVector;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;iterator myIterator;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      myVector.push_back(i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVector.begin(); myIterator &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; myVector.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;myIterator)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          myVector.erase(myIterator);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          myVector.insert(myIterator,  &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVector.begin(); myIterator &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; myVector.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;myIterator)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*myIterator = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result:&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;9&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A really helpful container! 😇&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Converting a std:string into an int and converting an int to a std::string</title>
      <link>https://www.badprog.com/c-tips-n-tricks-converting-a-stdstring-into-an-int-and-converting-an-int-to-a-stdstring/</link>
      <pubDate>Fri, 10 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-converting-a-stdstring-into-an-int-and-converting-an-int-to-a-stdstring/</guid>
      <description>&lt;p&gt;For the C, we had the famous atoi() function, but for C++, how can I convert a std::string into an int?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a great question, and the answer is easy, with the std::stringstream type element.&lt;/p&gt;
&lt;p&gt;In this tutorial, we will see how to convert a std::string into an int and how to convert an int to a std::string.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start by converting a string into a number (an int):&lt;/p&gt;
&lt;h2 id=&#34;1-converting-a-stdstring-into-an-int&#34;&gt;1. Converting a std::string into an int&lt;/h2&gt;
&lt;p&gt;So, let&amp;rsquo;s take an example of this conversion:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Errors / Warnings - After compiling</title>
      <link>https://www.badprog.com/c-errors-warnings-after-compiling-0/</link>
      <pubDate>Sun, 15 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-errors-warnings-after-compiling-0/</guid>
      <description>&lt;p&gt;As the same for the &lt;a href=&#34;https://www.badprog.com/c-errors-warnings-after-compiling&#34;&gt;C - Error / Warning&lt;/a&gt; section, I made this one to summarize common mistakes when I tried to compile my code.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s go to see some good errors and warnings in C++ (I&amp;rsquo;m sure it is also a great moment for you when you discovered these errors).&lt;/p&gt;
&lt;h2 id=&#34;1-maincpptext0x1f-undefined-reference-to-parentparent&#34;&gt;1. Main.cpp:(.text+0x1f): undefined reference to `Parent::Parent()&#39;&lt;/h2&gt;
&lt;h3 id=&#34;a-the-problem&#34;&gt;A. The problem&lt;/h3&gt;
&lt;p&gt;A very common error!&lt;br&gt;
Did you include the &lt;strong&gt;parent.cpp&lt;/strong&gt; file in your Makefile?&lt;br&gt;
Did you compile with this parent.cpp?&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Keyword - virtual</title>
      <link>https://www.badprog.com/c-keyword-virtual/</link>
      <pubDate>Sun, 15 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-keyword-virtual/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;virtual&lt;/strong&gt; keyword is used in different ways in C++.&lt;/p&gt;
&lt;p&gt;The most common way to use it is before a destructor.&lt;br&gt;
Indeed, with this virtual keyword we can specified that the children of a class will be deleted before its parent.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it with a tutorial.&lt;/p&gt;
&lt;h2 id=&#34;1-virtual-before-a-destructor&#34;&gt;1. virtual before a destructor&lt;/h2&gt;
&lt;p&gt;In this example, I created two classes, a Parent and a Child. So Child inherits from Parent.&lt;/p&gt;
&lt;p&gt;The headers:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Makefile - Adding flags</title>
      <link>https://www.badprog.com/c-makefile-adding-flags/</link>
      <pubDate>Sun, 15 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-makefile-adding-flags/</guid>
      <description>&lt;p&gt;A personal Makefile is sometimes better than a Makefile generated by default by your IDE, such Eclipse or Visual Studio C++ for example.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t know how to create one, let&amp;rsquo;s see it in this easy example of Makefile for C++.&lt;br&gt;
I added some flags for the variable &lt;strong&gt;CXXFLAGS&lt;/strong&gt;, it is different from the C language, where it is &lt;strong&gt;CFLAGS&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;With g++, you do not have to write the variable CXXFLAGS in your compilation line, but if you prefer, you can add it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Hello World</title>
      <link>https://www.badprog.com/c-qt-framework-hello-world/</link>
      <pubDate>Tue, 18 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-hello-world/</guid>
      <description>&lt;p&gt;Now that you have already &lt;a href=&#34;https://www.badprog.com/eclipse-qt-framework-installation&#34;&gt;installed Eclipse, Qt Framework Open Source and MinGW with the this tutorial&lt;/a&gt;, we will create our first program window.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go.&lt;/p&gt;
&lt;h2 id=&#34;1-hello-world-on-windows-os&#34;&gt;1. Hello World on Windows OS&lt;/h2&gt;
&lt;p&gt;Open Eclipse, on the Explorer &amp;gt; Right Click &amp;gt; New Project &amp;gt; Qt &amp;gt; Qt Gui Project.&lt;br&gt;
Write a project name such as &lt;strong&gt;hello-world&lt;/strong&gt;, then Next, Next, Finish.&lt;/p&gt;
&lt;p&gt;A lot of files and directories are created for you.&lt;br&gt;
Delete all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Windows - Hello World!</title>
      <link>https://www.badprog.com/c-windows-hello-world/</link>
      <pubDate>Sun, 02 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-windows-hello-world/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s create our first C++ application.&lt;/p&gt;
&lt;p&gt;For this tutorial, we will use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Eclipse Indigo CDT&lt;/li&gt;
&lt;li&gt;Cygwin&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you install your Cygwin binary into a different drive than from your development directory you can still use it.&lt;br&gt;
For example if you have installed Cygwin in &lt;strong&gt;C:/soft/&lt;/strong&gt; and want to work in &lt;strong&gt;D:/dev/&lt;/strong&gt;, go until C:/soft/ and run your Cygwin.bat file.&lt;br&gt;
Once open, write it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;cygdrive&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;then press the TAB key on your keyboard.&lt;br&gt;
You have now access to all your drives.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Eclipse - Installation of C/C&#43;&#43; Development Tools (CDT) and Cygwin for Windows</title>
      <link>https://www.badprog.com/c-eclipse-installation-of-c-c-development-tools-cdt-and-cygwin-for-windows/</link>
      <pubDate>Tue, 20 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-eclipse-installation-of-c-c-development-tools-cdt-and-cygwin-for-windows/</guid>
      <description>&lt;p&gt;In this tutorial of Eclipse, we will install C and C++ on Windows with some examples.&lt;/p&gt;
&lt;p&gt;Easy?&lt;/p&gt;
&lt;p&gt;Not really, but nothing is impossible of course!&lt;/p&gt;
&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;Because Windows needs another software to create and manipulate C and C++.&lt;br&gt;
This software is &lt;strong&gt;Cygwin&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;1-installing-cygwin&#34;&gt;1. Installing Cygwin&lt;/h2&gt;
&lt;p&gt;So let&amp;rsquo;s download it on the official website: &lt;a href=&#34;http://www.cygwin.com/&#34;&gt;http://www.cygwin.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you download all files available with Cygwin, prepare yourself to wait several hours.&lt;br&gt;
Indeed, you will need at least 7GB of data.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
