General C++ Programming - September 2022 (Page 2)

by PeteDD
class member array duplicating between instances
 
I have a class which is passed an array (the address of Dallas temperature devices). The data from ...
[9 replies] Last: If I were to take a wild guess I'd say you ran afoul of the ODR. https... (by mbozzi)
The same to this in a compile time
 
How to have this at compile time instead for (int i = 0; i < 41; ++i) interval = 0; ...
[8 replies] Last: [quote=JLBorges]https://godbolt.org/z/G5oKx8hEj It should be noted th... (by Peter87)
Reading output from valgrind
 
Hello. I am writing a Monte Carlo simulation engine, and I am experiencing what I believe to be memo...
[5 replies] Last: [quote=lastchance]You have the -g flag set in your compile command: so... (by Peter87)
by helios
Graphs
 
How do you do general graph structures? I.e. those where any node in the structure can point to any ...
[13 replies] Last: Yes, in my Graph structure, Node might have better named "NodeId".... (by Duthomhas)
integer sum problem
 
I am trying to solve the problem. Is my logic correct? https://www.chegg.com/homework-help/questio...
[14 replies] Last: Here's a couple of alternatives. #include <iostream> #include <strin... (by lastchance)
by PeteDD
Link time error - undefined reference
 
I'm at a loss (once again). In a class method, I am calling a function of the Dallas Temperature l...
[11 replies] Last: [quote=doug4]If this template function gets expanded and compiled outs... (by Peter87)
by t im
Mutex Test and Set
 
I read the code about Mutex test below: static int flag=0; void lock(){ while(TestAndSet(&flag,...
[4 replies] Last: Thanks for your reply which makes me figure it out. (by t im)
Stack
 
Please help me, lets assume that we have an empty stack in the program when executed. When I pop 2 o...
[6 replies] Last: In the best tradition - 'We'll leave that as an exercise for the reade... (by seeplus)
Integrating C++ frontend with HTML backend?
 
Hi guys, I was working on a project recently, the project used Python as the backend and HTML/CSS a...
[2 replies] Last: Flask is a small web framework. It's more sophisticated than running ... (by kbw)
vector error
 
I am trying to solve this in C++. How can I test it? I end up with the below errors while compiling ...
[14 replies] Last: @leo2008, FWIW. my approach was: - DRAW the first example; - think abo... (by lastchance)
array of integer problem
 
Hi all I am trying to solve this problem in C++. Below is what I am trying to do, but has some lo...
[3 replies] Last: Thanks everyone for your valuable inputs. (by leo2008)
string issue
 
I am trying to solve below issue. For example, given K = "Test" and string J as follows: "Jowal Da...
[16 replies] Last: 17.1.6 isn't the latest version - 17.3.4 is. Update it! It then compil... (by seeplus)
How to get started with my stack?
 
So I need to write 2 functions using the standard stack container called evaluateInfix() and infixTo...
[13 replies] Last: Ya that's basically the same code I keep seeing. My bad for the confus... (by jetm0t0)
by mbozzi
Can I use std::int8_t* where I want signed char*?
 
I like to create shorter names for fixed-width integer types: using i32 = std::int32_t; using i64...
[14 replies] Last: Yes I know. I've used C++ since before C++98 - but hands up at the bac... (by seeplus)
File input value as a float?
 
Hello everyone. I am currently writing a code where it reads a file with information on an item. The...
[5 replies] Last: Thank you so much. I didn't exactly do the same thing you showed but t... (by BrainD3ad)
by t im
Question on Virtual Function
 
Just as the code below: class A { public: virtual int func(int i = 1) { std::cout << "clas...
[6 replies] Last: What? #include <iostream> class A { public: virtual void func(i... (by keskiverto)
How to protect dlls?
 
Hello all , Please, I have two questions, the first : I have a dll file that I inject into a game...
[7 replies] Last: Thanks kigar , i use cheat engine to inject my dll , but game is cras... (by Hawlong)
30/Distance = force
 
Hello rubber ducky. I'm writing a game that runs at 60fps. I'm trying to come up with a way to push ...
[2 replies] Last: OK. You kind of just rocked my world there. Last time I ran any kind o... (by newbieg)
why is it necessary that this code calls std::forward<>?
 
Hi, I have this code: int retInt() { return 6; } template<typename T> auto f(T&& val) {...
[1 reply] : You don't need to, it does nothing for this example. It would do somet... (by Cubbi)
Implementation of std::forward
 
Hi, Looking at the definition of std::forward, I found this implementation which does not appear ...
[1 reply] : If _Ty is a lvalue reference then _Ty&& is a lvalue reference too.... (by mbozzi)
September 2022 Pages: 1234
  Archived months: [aug2022] [oct2022]

This is an archived page. To post a new message, go to the current page.