General C++ Programming - May 2020

Accessing memory error
 
Hello, I am writing a program and it is compiled without any error. However, when I run that prog...
[4 replies] Last: getFriendlyPose() is being called in an infinite loop. Is it allocatin... (by dutch)
i have two text files which contain integer type data i want to perform bubble sort on them.
 
#include <iostream> using namespace std; #include <fstream> #include <string> int main(){ cons...
[1 reply] : You should edit your post to add code tags so that your code retains i... (by dutch)
Help with prime number code C++ (1,2)
 
Hey everyone. I am having trouble with my code and I do not understand what is going on. I wrote a c...
[28 replies] Last: I'm not the op. I just been playing around with it. @dhayden.... thi... (by markyrocks)
Storing data in Vector of Struct
 
Hello, I am writing a program using ROS Workspace. There is a structure of data and which is conver...
[7 replies] Last: As far as I can tell, that will compile, but is that really what you w... (by helios)
std::function
 
Why does std::function require that its function object be copy constructable? I wrote a custom vers...
[1 reply] : https://quuxplusone.github.io/blog/2019/03/27/design-space-for-std-fun... (by dutch)
No Output, where is the problem?
 
DISCLAIMER: I don't want somebody to solve this for me, I just need someone to look the code over a...
[1 reply] : Some points. 1. Writing 120 lines all in a single function isn't good... (by salem c)
by frek
C++ move semantics
 
Hello all, Do you, please, agree with the text below? • We refer to traditional C++ references ...
[3 replies] Last: I also read about return value optimization on the Web. But I think w... (by TheToaster)
A lambda with a dangling reference...
 
Hi, I have a lambda with a dangling reference (i.e. it captures by reference a number passed by v...
[3 replies] Last: it captures by reference because it has [&] in the lambda.. (by JUANDENT)
by volang
IOCP Threadpool
 
From microsoft: "When a process creates an I/O completion port, the system creates an associated qu...
[no replies]
Initialize pair constructor
 
Good evening to everyone, I'm learning how to use pair function, and my compiler says to me that ...
[10 replies] Last: Okay i get it, i'll try to solve it thank you! (by AlessandroTZ)
Infinite Loop?
 
string Automaton :: generation_to_string(const vector<int>& gen, size_t width){ if(width%2 ==0)...
[5 replies] Last: @doug4 The issue seems to be that (width-gen.size())/2; can be negativ... (by aceadams)
How do I stop getting it to output 1
 
Hi this is my code: #include <iostream> using namespace std; void primeNumbers (int a, int b)...
[2 replies] Last: Why don't you break the tasks in 2 parts. One function that checks if ... (by Thomas1965)
by Vycues
Mouse moving a picture box in C++ GUI
 
I am trying to move a picture box and drag it to a different location on the form using the left but...
[2 replies] Last: Thank you so much. it works now. (by Vycues)
Huffman
 
My code is #include <iostream> #include <map> #include <fstream> struct huffman_node { int priori...
[8 replies] Last: There are a number of problems. freq_dist_from_file() is recursive, b... (by kbw)
how to get the current executable directory?
 
Hi, filesystem::current_path() returns current working directory but I need the directory from wh...
[6 replies] Last: GetModuleFileName works!! Thanks!! Juan (by JUANDENT)
Unique_ptr with templates
 
Goodmorning to everyone. I'm trying to use smart_pointers for representing template variables into c...
[2 replies] Last: I'm so sorry, i've just noticed an error in the rest of my program tha... (by AlessandroTZ)
How to change my code?
 
Hi everyone, I’m quite green in programming but I want to know how to change my code that generate...
[7 replies] Last: @helios, Thanks for the info. Now I know. (by doug4)
by frek
Temp objects
 
Hi all, A quick question: using namespace std; double t = 5; double test() { return t; } int ...
[6 replies] Last: Depends on your system, but here's one set of answers: https://docs.mi... (by Repeater)
by volang
new unique char inside each object
 
struct ClientInfo { WSABUF Buffer; ClientInfo() { Buffer.buf = new char ; Buffer.len = 200...
[5 replies] Last: You're copying an object into another, where the class of both contain... (by helios)
Help with implementing Dijkstra's Algorithm
 
Hello, I am having trouble implementing pathfinding in my program. I am using coordinate based vert...
[5 replies] Last: I managed to get it implemented by going back after my vertexes are cr... (by tigerking)
May 2020 Pages: 123... 9
  Archived months: [apr2020] [jun2020]

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