Click here to Skip to main content
15,889,096 members
Everything / Programming Languages / C++17

C++17

C++17

Great Reads

by Jovibor
Owner-draw list control with tooltips, editing, colors, sorting, hyperlinks, columns hiding and lot more.
by sebjameswml
morph::vvec allows you to do vector math without any external libraries
by Bartlomiej Filipek
What performance can we get from C++17 parallel algorithms?
by Mikhail Semenov
This article shows that double-ended vector is much faster than std::deque and should be preferred.

Latest Articles

by Shao Voon Wong
C++17 easy string to number and vice versa conversions in header-only class
by Michael Chourdakis
A set of tools to create a new VCXPROJ file automatically
by sebjameswml
morph::vvec allows you to do vector math without any external libraries
by Coral Kashri
CoreC++ talk - experience summarize, and self opinions

All Articles

Sort by Score

C++17 

6 Apr 2020 by Jovibor
Owner-draw list control with tooltips, editing, colors, sorting, hyperlinks, columns hiding and lot more.
19 Sep 2023 by sebjameswml
morph::vvec allows you to do vector math without any external libraries
25 Nov 2018 by Bartlomiej Filipek
What performance can we get from C++17 parallel algorithms?
10 Sep 2022 by Mikhail Semenov
This article shows that double-ended vector is much faster than std::deque and should be preferred.
27 Jan 2024 by Shao Voon Wong
C++17 easy string to number and vice versa conversions in header-only class
4 Mar 2020 by Michael Chourdakis
A small player for your clue game
3 Jun 2021 by honey the codewitch
Explore techniques for drawing using GFX
9 Jan 2023 by honey the codewitch
A project that allows you to use a knob to control a fan's RPM with feedback
8 Dec 2021 by John M. Dlugosz
A simple pair of iterators provides many handy use cases
23 Jun 2018 by John M. Dlugosz
Using the new structured binding feature in your API design
4 May 2021 by honey the codewitch
Use an ILI9341 display efficiently from an ESP32 without the Arduino framework. Load JPEGs.
9 Nov 2023 by CPallini
You forgot to include the new header which provides standard library implementations of the placement new (as an alternative, you could provide your own implementations). The following code compiles and runs fine on my Linux box. #include...
18 Sep 2022 by Mikhail Semenov
This article proposes a mapping algorithm, called Segmented Map, which is almost as fast as Flat Map is random access and enumeration of elements and close to std::map in insertion of elements.
14 Mar 2023 by sebjameswml
Walks you through the steps needed to draw high quality 2D graphs in your C++ programs using the header-only library morphologica
8 Jan 2024 by Richard MacCutchan
I think the problem is here: if (sock % m == 0) { sock++; } sock--; // If you add 1 to sock and then subtract 1 it will go on for ever but I am not sure what those lines of code are supposed to do.
16 Jan 2020 by Shao Voon Wong
Benchmark of Singular Min/Max and Iterator Versions
19 Sep 2020 by Daniel Petrovic
In this tip, I want to represent a quick lightweight possibility (one of many) for parsing command line arguments on the fly using C++17.
19 Sep 2020 by sdancer75
A graphical time line editor to help you create and prototype animations. It is useful for adjusting variables and checking out how the effects change over time with keyframing and easing/twining functions.
17 Jan 2022 by Giuseppe Pischedda
Part 2 - Templates and variadic templates
2 Feb 2023 by Bruno van Dooren
Ways to enforce an interface contract on static methods, similar to what you would expect from static virtual methods if they'd exist in C++
8 Nov 2023 by honey the codewitch
new expression - cppreference.com[^] Useless. Placement new operator in C++ - GeeksforGeeks[^] Bunk. Placement syntax - Wikipedia[^] Written by somebody who doesn't care if it's understood by anyone. Apparently I can't read code. Apparently...
20 Jan 2024 by Michael Chourdakis
A set of tools to create a new VCXPROJ file automatically
13 Jun 2019 by Patrice T
Quote: Where should I start if I want to learn in a hands-on capacity. Google and YouTube ! You need to search for tutorials about the language and the GUI framework you choose. Google/YouTube tutorial c++ GUI framework Replace "framework" with its name when you know it. [Update] Quote: But if...
13 Nov 2019 by Mikhail Semenov
This article discusses an implementation of multidimensional array class with resizable dimensions. Access to subarrays and their swapping are allowed. Benchmarks are provided, which compare the performance of this implementation with Boost and standard C arrays.
3 Jan 2020 by goranorsander
A class template for specializing fundamental types
17 Oct 2020 by George Shagov
Two and three states Fibonacci Rabbit's Machines
15 Dec 2020 by Richard MacCutchan
You need to use the correct syntax to access a function: shivam.get(); shivam.set(); Also it is not generally the best idea to have class functions getting console input. It is better to do that at the main level and then use set to...
15 Dec 2020 by CPallini
As suggested, you could try a more idiomatic approach: #include using namespace std; class employee { int id; int count; public: employee(int id, int count): id(id), count(count){} void set_count(int new_count) { ...
10 Apr 2021 by honey the codewitch
I'm trying to invoke a template function from inside another template, and the C++ compiler is getting confused trying to parse my code. Basically what's happening is it can't tell that my function is a template function. It thinks it's a field,...
10 Apr 2021 by Greg Utas
This is fancier than anything I've done with templates, so I could be off base here. But recently there was a question involving the use of typename to explicitly flag a type within a template, and yours looks related to that, only a little...
17 Apr 2021 by honey the codewitch
GFX IoT graphics library part 2 - device independent bitmaps
25 Apr 2021 by honey the codewitch
Explore the basic drawing functionality provided by the GFX IoT library
8 Jan 2022 by Stefan_Lang
You are calling the display method on your Hotel object and that displays the Floors within that Hotel, but you never correctly initialized the Floor objects stored inside your Hotel object. Instead you created and initialized a separate Floor...
14 Jan 2022 by Giuseppe Pischedda
How to create a Win32 C++ Application that "consumes" a C++/WinRT Component Runtime
3 Feb 2022 by M Imran Ansari
You are assigning in If block instead of checking the equality. Correct If condition if(num==0) { cout
5 Dec 2022 by OriginalGriff
Quote: The below code is what I have tried but it's entirely wrong! Yes. It is. And you don't know why. Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. How you use it depends on your...
7 May 2023 by merano99
As Richard already pointed out, there are quite a few Windows system calls in the rest of the code and it would certainly be possible to get the pointer without assembler, but if you really want to, you can do it with VisualStudio and assembler. ...
23 Aug 2023 by Rick York
It is not entirely clear what you are trying to do. You state you want to have an edit control update itself but then you list it as CServicesDlg::EdtCompanyName(). That is clearly a method of a dialog class and it is unclear what relationship...
1 Sep 2023 by merano99
Presumably the question again concerns an edit control in a dialog. There were already answers for this. MFC app edit control updating itself[^]
6 Sep 2023 by OriginalGriff
We can't tell, we have no access to your code while it is running, so we have no idea what is in m_RadIsntExist or what it should contain. So, it's going to be up to you. Fortunately, you have a tool available to you which will help you find out...
30 Aug 2023 by Richard MacCutchan
Using AI is largely a waste of time to solve programming issues, or research "how to" questions. Microsoft provides a comprehensive set of documentation that you should make use of. Using ShellExecute runs the search in a separate Window. So...
8 Jan 2024 by OriginalGriff
As soon as sock is divisible by m, it is incremented and immediately decremented again - so the next loop iteration has the same value of sock and the loop never exits. Since the loop never exits, the code never reaches the cout and you never see...
20 Mar 2018 by Jochen Arndt
The destructor is called when the object goes out of scope. That is after the add() call in your code. But the rounding mode affects also string conversions. So the difference in the output is not created by the add() operations but by printing out the results: - With resetting the mode cout...
30 Nov 2018 by CPallini
Yes, it looks a compiler problem (at least g++-7 compiles it without complaining). Why don't you an std::array, instead auto myArray = std::make_shared>(); ?
30 Mar 2020 by Maciej Los
Please, follow the instruction from MSDN: Linker Tools Error LNK2019 | Microsoft Docs[^]
31 Mar 2020 by steveb
Did you include the .LIB file in your linker input?
15 Dec 2020 by Member 12982558
get and set are functions and need parentheses
11 Apr 2021 by honey the codewitch
A device independent graphics library for IoT devices. Part 1 of a series.
28 Apr 2021 by Rick York
This is not a code conversion service but I will give you a hint. The Pascal for loop of this form : for x1 :=0 to 12 do looks like this in c++ : for( x1 = 0; x1
3 Aug 2021 by Stefan_Lang
We're developing plugins for a third party executable with a C++ API. There is no SDK available for the executable, and, worse, no debug version. The API uses at the very least std::vector and MFC CString which to my knowledge are not compatible...
1 Aug 2021 by KarstenK
In this cases I like to write a log file with the debug texts and some error messages. Best is to check the amount of written data in some debug tests and only log errors and problems. Normally the problematic code areas are knows so concentrate...
2 Aug 2021 by Greg Utas
Release builds have reached the point where the trade-off between performance and debugging is unacceptable. I'm using VS2017 and face the same problems. Here[^] are the compiler settings I use. They help, but it's still not as easy as a debug...
2 Aug 2021 by Rick York
When I have done this I disabled optimizations in the release build of the library and enabled writing of the debug symbols file. I then set the hosting executable program for debugging the library to be the one in question and then set break...
20 Oct 2021 by KarstenK
The MS controls are creating an own copy of the bitmaps. So when you want to change them, you need to destroy the control and recreate a new object with the new bitmaps.
25 Oct 2021 by k5054
You don't say what compiler/OS you are using, but since this above snippet is accepted by gcc, I am guessing that you are using MSVC, which does not support variable length arrays. You will have to use dynamic memory allocation to create an...
3 Feb 2022 by Tony Hill
You are not testing num for 0 correctly. You should do if(num == 0) not if (num=0) In your code you are assigning 0 to num because you are using a single equals sign which will be successful which the if statement evaluates to...
16 Oct 2022 by merano99
The command system() creates a new process to handle the specified command. char cmd[10]; strcpy(cmd, "dir"); system(cmd); In most cases, this is neither performant nor useful. But of course you can start a process with C this way. You could...
19 Oct 2022 by Alexandrnn
#include #include int main() { system("dir"); puts((char*)stdin); } #include #include #include int main() { char cmd[10]; strcpy_s(cmd, 10, "dir"); system(cmd); puts((char*)stdin); }
20 Oct 2022 by Rick York
Have you investigated the RegDeleteKeyExA function (winreg.h) - Win32 apps | Microsoft Learn[^] ? Here is another sample : Deleting Registry Key with Subkeys Win32 C program example[^]
5 Dec 2022 by merano99
Saving the calories in a vector would be a good idea. std::vector numbers; Then it would be practical to write the calories as described in a file calories.txt and read this file line by line. At each blank line write the sum into the...
26 Mar 2023 by Rick York
Here is one place to start : cplusplus.com : fgets[^]. The sample code shows you how to open a file, read from it, and close it. That's what you need to do to read the data from the file. This function - cplusplus.com : atoi/[^], can be used...
20 Aug 2023 by honey the codewitch
I have an issue where I'm writing out a simple 8-bit grayscale bitmap as I read it from a stream. The issue is this: I'm going top to bottom left to right, and attempting to read the pixels out of the bitmap sequentially. I feel like this...
20 Aug 2023 by Andre Oosthuizen
From what I could read (might be missing the ball completely) - There shouldn't be a need for the extra seek operation, as you're already calculating the offset based on the pixel's position. It is possible that the issue might be related to the...
26 Aug 2023 by merano99
Rick has already written the basic solution in Solution1, here again in more detail: To display a summary of three other text fields in the text field EdtDescription, a simple solution would be to react on EN_CHANGE of the three fields and call...
1 Sep 2023 by OriginalGriff
That's a little complicated, because generally speaking two instances of a control shouldn't even know that the other exists - it breaks OOPs principles if they do, unless one is the child of another (and parent-child is trivial, so I'm pretty...
1 Sep 2023 by Richard MacCutchan
You cannot expect there to be YouTube tutorials on every question you come up with. As already suggested, you should use the documentation to check what features are available in each control that you are using: CEdit Class | Microsoft Learn[^].
29 Aug 2023 by Richard MacCutchan
Your time would be better spent studying the documentation for the CComboBox Class | Microsoft Learn[^]. It is a simple matter to use one of the Findxxx methods to checlk if an entry already exists before adding it to the list.
30 Aug 2023 by Dave Kreskowiak
Why would you want to launch an entirely separate process (rundll32) that will not communicate with your app at all? Using the query window will do nothing in your application. You app will never know the user did anything in that window because...
20 Jun 2023 by Coral Kashri
CoreC++ talk - experience summarize, and self opinions
4 Oct 2023 by OriginalGriff
Have you tried ANDing it with 111111b? Since the value can't be bigger than 63 that might shut the compiler up?
24 Jan 2024 by Dave Kreskowiak
A better choice would be a Windows Service since they have no UI at all. Trying to do this as a normal, user launchable app seems ... suspicious.
24 Jan 2024 by Maxim Kartavenkov
You can create regular windows application not the console application, just do not create any dialogs and proceed like you do as you had the console application. There will be just linker configuration change and the function WinMain instead of...
24 Jan 2024 by k5054
It's not clear what you're trying to achieve. If you want to create a service, then you should follow the advice in Solution 1. If you're trying to create a commandline utility, like copy for example, then what you're doing is probably what you...
26 Sep 2022 by Death Smoke
I'm trying to make a connection between two computers both of them are using tp-link adapter , but i'm not receving anything from client . #include #include using namespace std; int main() { ...
20 Mar 2018 by Member 3733166
Run the the following program twice. Once with the given destructor and once with "std::fesetround(value);" removed from the destructor. Why do I receive different outputs? Shouldn't destructor be called after function "add"? #include #include #include struct...
20 Mar 2018 by CPallini
It is a cout artifact. Try, for instance std::cout
30 Nov 2018 by Member 14068785
Dear experts, I have a simple code which uses shared_ptr with arrays. The line of the code that gives problem is: std::shared_ptr myArray(new double[10]); I'm using a Mac OS 10.14.1 and Xcode 10.1 from command line: c++ -std=c++17 -o sharedPtr sharedPtr.cpp Apparently I think it...
11 Mar 2019 by Member 10068530
I want to consume c++17 modules from managed clr/c++ code. Is it possible? What I have tried: I have built a dll with c++ modules. Consumed it from a console application without turning /clr. Everything worked. Once i turn on /clr switch, it does not work. My clr console application has...
11 Mar 2019 by steveb
There are many ways you can do that: 1. Implement your C++ 17 as DLL and export "C" function interface. There are ton of material on google how to call DLLs from CLR or .Net langs. 2. Implement as COM DLL. This one can be called by any language VB, C#, C++, C etc 3. Implement as COM EXE server....
26 May 2019 by Member 14470453
I have created a project in Dev C++, but I need to create a window and control mouse events over a button. Could you help me please? What I have tried: I used next cod, but it do not works properly // Grafica de la circunferencia //#include #include #include ...
26 May 2019 by Tonex247
Buttons are actually windows and are created same way: #define btn_ID 5000 //used as the button's id during creation HWND hwndButton = CreateWindowEx( 0, L"BUTTON", // Predefined class; Unicode assumed L"OK", // Button text WS_TABSTOP | WS_VISIBLE | WS_CHILD |...
26 May 2019 by CPallini
It looks your trying to use a port of the BGI library to Windows. Here you may find documentation and smple code: Borland Graphics Interface (BGI) Documentation[^].
14 Jun 2019 by da.ko
Where should I start if I want to learn in a hands-on capacity. I know a bit of c++ syntax but I don't know how to use c++ with a GUI. What project should I start with to learn through hands-on research and trial and error? What I have tried: This. Plus all these extra chars so I am over thirty.
14 Jun 2019 by altomaltes
As a low entropy IDE, you can try code::blocks Just install it and do File->new->project->win32 gui project Choose C++ when asked. This will create a minimal debuggable c++ project. Stepping and breakpointing it can help to understand. I don´t advice Visual Studio because is more about Microsoft...
31 Mar 2020 by Member 14162950
I am trying to build a C++ example program from the Phidgets company website that monitors and logs three devices. Using either VS2017 or VS2019 gives 20 lines of messages similar to this one: Log_Mul_Phids(C17_9).obj : error LNK2019: unresolved...
25 Apr 2020 by WOLF 2018
I am working of a DLL for a test and i keep getting socket errors. i am trying to to connect to a server localhost, when it connects i close the server and i want it to continue to try and connect but as i open the server again it keeps...
25 Apr 2020 by User 11060979
Because IsExit is global (whyever) you need to set it to false each time before the loop, otherwhise IsExit reamains true after calling Networking once: ... // while loop to send and receive data IsExit= false; while (!IsExit) { ... }
25 Apr 2020 by WOLF 2018
Ok i found the problem std::string GetData(SOCKET sock) { char buf[1024]; int bytesReceived = recv(sock, buf, 1024, 0); if (bytesReceived == SOCKET_ERROR) std::cout
24 May 2020 by Shao Voon Wong
How to allocate variable-size arrays on the Stack in C/C++
15 Dec 2020 by alex bottom122323
I want to try making classes and objects but it's giving me some errors which I am not able to resolve. Below is my code: #include using namespace std; class employee{ int count; int id; public: void set(void){ ...
23 May 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
23 May 2021 by Patrice T
Quote: Kick start 2021 round C Your problem is that your code is not related to Google's problem. Your task is to write code solving the requirement. The word 'problem' in Google's problem is a requirement, the word 'problem' in your code is...
6 Jun 2021 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
3 Aug 2021 by steveb
You can include debug information in the release build. It will behave as if it was debug build, i.e. stepping through code, breakpoints in code etc.
20 Oct 2021 by Rick York
Yes, KarstenK is correct. If I were you, I would preload all the bitmaps and maintain handles to them. Then when the selection changes building your list will be very fast because you don't have to load any of them. You can just assemble the...
25 Oct 2021 by shadi zgheib
I keep receiving an error saying "Expression must have a constant value the value of variable 'n1' cannot be used as a constant ". I don't know what am I use suppose to do to fix it. void merge(DataType theArray[], int first, int mid, int last)...
25 Oct 2021 by Patrice T
void merge(DataType theArray[], int first, int mid, int last) // did you forgot the '{' here ? int i, j, k; int n1 = mid - first + 1; int n2 = last - mid; int L1[n1], R1[n2]; //n1, n2 are giving me the same problem mentioned above for (i =...
18 Nov 2021 by OriginalGriff
Firstly, there is no obvious connection between the input and the desired output - so go back to the original assignment, and read it carefully. Then try to process the input manually and generate the output - hwne you hav eit manually, it should...
18 Nov 2021 by KarstenK
You best start with some Learn C tutorial to learn the basic. Pay attentation how to use the debugger. Without the knowledge and skills to develop code you cant move on and will get a bad rating from your teacher. tip: also search on Youtube...
14 Dec 2021 by OriginalGriff
You understand OR, I assume? a || b is true is either a, b, or both is true: it is only false if both a and b are both false. And in C (and so C++) any non-zero value is true, so any valid link in l1 or l2 or carry will mean the loop goes around...