Search:
Type: Posts; User: wolle
Search:
Search took 0.15 seconds; generated 8 minute(s) ago.
-
January 6th, 2023, 10:11 AM
Today you can also do this,
char buffer[100] = {0};
-
January 1st, 2023, 01:53 AM
Assuming the OP wants a vector of random-sized matrices filled with random integers, this is my take. The matrix implementation follows the std::mdspan philosophy,
#include <iostream>...
-
December 29th, 2022, 02:03 PM
The 3D vector looks like a 1D vector of random-sized 2D vectors filled with random one-digit integers.
Another natural C++ representation would be to keep the 1D vector but encapsulate the 2D...
-
December 29th, 2022, 01:06 PM
I know. The std::mdspan is a C++ 23 feature. What I mean is that the principle it represents is already available.
-
December 29th, 2022, 01:52 AM
Rather than build the two multidimensional vectors, you could use two one-dimensional vectors together with index mapping functions. As of C++ 23, this approach has standard support by std::mdspan,...
-
December 24th, 2022, 02:25 AM
Your reply is cut & pasted from the "What is recursion?" section here,
https://www.freecodecamp.org/news/understanding-recursion-in-javascript/
If you are not familiar with the concept of...
-
December 17th, 2022, 03:31 AM
Maybe the idea is not to hog the remote connection with frequent lock requests. A compromise would be to send a couple of quick requests and, if unsuccessful, wait a little longer, like
int...
-
December 13th, 2022, 06:03 AM
A recursive call in isolation does not explain how the recursive function works. That requires, at least, that the termination criterion is also known. Here is my guess as to what the recursive...
-
November 28th, 2022, 10:08 AM
I have never tried it before, but std::span of C++ 20 seems a nice way of using C-style arrays with the standard library. An advantage is that it works with std::vector and std::array too.
...
-
November 27th, 2022, 01:44 AM
Oops! Well, converting between languages is a daunting task. Nevertheless, in this case, the converter should have issued a to-do warning (as I see it usually does when it omits something). Unsigned...
-
November 26th, 2022, 05:03 AM
I agree. The code the OP posted looks like written by a C++ newbie, which it probably is, considering where it originates (as someone's solution to a textbook exercise). No programming language...
-
November 26th, 2022, 03:01 AM
Well, as they say on the moon: Switching to std::vector would be one small step for you but one giant leap for the quality of your code. :)
-
November 25th, 2022, 12:33 AM
In the function case, the array sizes are unknown. I suggest you switch to std::vector (or std::array) rather than using old C-style arrays. It will work and is better C++.
-
November 24th, 2022, 11:50 AM
Your assignment seems to come from here as someone's solution to an exercise in Absolute C++ by Savitch.
...
-
November 24th, 2022, 03:26 AM
The immediate problem is that you declare a pointer variable in the constructor but never assign a pointer to it,
Pixel *pix;
And even if you did, the pointer will get lost when the...
-
November 9th, 2022, 05:25 PM
If the null pointer has meaning and represents "nothing" or "empty" or something of that kind, I would use the Yoda condition. Otherwise, the null pointer is an error, and I would check for it...
-
November 6th, 2022, 02:23 AM
If you accomplish a certain functionality according to the OO paradigm using OO patterns, you can achieve the same with the FP paradigm using FP patterns. So in this sense, it is true that FP...
-
November 4th, 2022, 10:40 AM
You posted the same question here and got many high-rated replies,
https://stackoverflow.com/questions/327955/does-functional-programming-replace-gof-design-patterns
But it was 13 years ago, so...
-
October 15th, 2022, 02:13 AM
These are links to the CppCon 2022 keynote speech, where Timur Doumler presents what he considers the four most important features of C++ 23, namely: deducing this, std::expected, std::mdspan, and...
-
October 5th, 2022, 12:33 AM
You inherit the SummaryStrategy class into AverageSummary. It means AverageSummary is_a SummaryStrategy. But to be that, AverageSummary must implement all abstract methods of SummaryStrategy. Does it...
-
September 26th, 2022, 02:28 AM
You could start from an implementation of a binary tree. There are plenty available on the internet and in textbooks.
In the node declaration, replace the left and right child node pointers with a...
-
September 24th, 2022, 02:33 AM
The TIOBE index is a renowned indicator of the most popular languages right now,
https://www.tiobe.com/tiobe-index/
An advantage of TIOBE over one-off studies is that TIOBE also shows the...
-
September 17th, 2022, 01:28 PM
Visual C++ was once a free-standing product but has become part of Microsoft Visual Studio. There is a free community edition available,
https://visualstudio.microsoft.com/downloads/
Select...
-
August 31st, 2022, 08:24 AM
What is the nature of your admission? You provide a link to what seems to be an outsourcing company. Have you become a subcontractor to this company and now want to know what you need to study to...
-
August 21st, 2022, 04:07 AM
Maybe the variable is a DWORD array. In that case, the 5 you see could denote the array size (rather than the DWORD size.)
|
Click Here to Expand Forum to Full Width
|