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

Am I dealing with dangling references?
 
By defining methods of a class &&, and chaining the calls, am I dealing with dangling references?? My class: template<typename ConcreteBuilder> clas...
[5 replies] Last: std::move() is required; copy elision can't be applied to member obj... (by JLBorges)
Address and pointer
 
Let's say i have an int variable int number = 5 Does the expression "&number" returns a type int*? Meaning the address is a pointer to an int? Since it...
[2 replies] Last: Thanks (by Worldtreeboy)
ASCII to string
 
Hallo c-plus plus, Is there a way, to get the letter ASCII(code:10) to print to a string. I will keep looking on the net, on this form. tnx
[10 replies] Last: Glad you found that... I was trying to say as much, but I assumed you... (by jonnin)
What does this struct . do
 
Please explain to me what this code does struct sPickDropBuffer { DWORD OnlyDword{}; BYTE Filler {}; BYTE* pBuffer{}; sPickDropBuffer(DWORD __dwor...
[4 replies] Last: Thanks JLBorges , (by Hawlong)
by frek
Working with array (1,2)
 
Task description : A non-empty array A consisting of N integers is given. The leader of this array is the value that occurs in more than half of the elements ...
[30 replies] Last: Don't worry, I don't use Big-O anyway. I prefer Big Mama (by zapshe)
by ruzip
Steps in Loop in C/C++
 
What are possible ways to skip or step a variable in a loop in C/C++ particular in C only? In Basic, there's the STEP for x = 0 to 10 step 2 print x ; print...
[7 replies] Last: ... and can also be used where a condition is required - eg with if an... (by seeplus)
AVX and other SIMD
 
Does anyone have example of code that tends to generate avx or other simd instructions in the resulting compiled assembly file? I'm on linux, g++, but can switc...
[5 replies] Last: You could try looking at the generated code for parallel algorithms in... (by mbozzi)
by PacR
Help with iterator
 
Hi im trying to use iterator in line 41 of my code but it dont work please help. #include <iostream> #include <list> #include <iterator> class neuron{...
[9 replies] Last: Possibly something like: #include <iostream> #include <list> class... (by seeplus)
ifstream and put it in a string
 
Hello C++'s, I am trying to open a TEXT file and put it in a string. string line; ifstream infile; infile.open("data_01.LIB"); infile...
[7 replies] Last: c++ : seeplus , thnx I works fine now. Tnx a lot (by nvthielen)
by helios
Bidirectional RPC
 
In most RPC systems, the roles of client and server are very asymmetric. All the server does is listen for requests from the client and respond to them: //+-...
[5 replies] Last: I am not sure there is a major package that does this by design. The... (by jonnin)
by frek
std::unordered_map (1,2)
 
We know that in associative unordered containers in STL, like std::unordered_map , the hash functions depend upon the key (among the key-value pair) for th...
[20 replies] Last: note that a great deal of effort has been put into generating hash fun... (by jonnin)
Enum & vector returns a "not declared in this scope" error when it's included in the header.
 
I'm trying to make a simple Lexer that breaks up a string into characters and tokenizes them. But I keep getting a "not declared in this scope" error even thoug...
[4 replies] Last: Oh my gosh, how could I have missed that? Thanks again Peter, I apprec... (by gabriel11)
CreateWindow(TEXT("Edit") get string input
 
He, folks I have a control object. ( CreateWindow ) but can get the string in the TEXT edit window. ( LIB_MEMO ) to add later on whit a DB or local LIB. from ...
[2 replies] Last: He, Genade tnx for the help. string totalString; totalString = ... (by nvthielen)
This trick allows a member template to be called as a "copy ctor": but why?
 
Deleting the copy ctor with argument const volatile allows a member template to play the role of a copy ctor, but i am not sure why?? class C { publi...
[3 replies] Last: Why is member template never called in this last case? because non-t... (by Cubbi)
by ruzip
Free up Global Pointers in C
 
How do I properly free up global pointers, specifically character pointers?
[5 replies] Last: Thanks guys, I now got a better understanding of this matter. also th... (by ruzip)
by frek
Do we still need class template argument deduction guide in C++20?
 
Hi, Here the deduction guide is not needed on most compilers: #include <iostream> template<typename T, typename U> class Test { T t; U u; public: ...
[9 replies] Last: Yes, thanks. Here's an example that actually compiles: template <ty... (by mbozzi)
by Tima11
When I pass const char* as an argument in class constructor it changes its value.
 
I made a function which converts int to const char*. It works like this: https://ibb.co/6PxcP94 . Then, when i try to pass it to the class constructor it change...
[9 replies] Last: typically char is single quote: '1' I don't recall what happens when ... (by jonnin)
How to input a 2d vector into a file
 
Hi I have this code that has this input and I need to put it in the file and I do not know how, this are the instructions:"If the user has generated a puzzle, t...
[1 reply] : Here's one way to do it, there are faster ways to write to disk, but t... (by newbieg)
My 2d array is not out putting all the words (1,2)
 
I have this code which ask the user for how many words and makes a 2d array but the words the user input do not always print all of them. #include <iostream>...
[24 replies] Last: I really do suggest dumping the C library random functions and learnin... (by deleted account xyzzy)
by ruzip
Macro or #define the 'struct' keyword
 
I would like to define the struct keyword to something else or perhaps use macro to add another keyword but still is using struct.
[7 replies] Last: Thanks for the info guys. I decided to just go for typedef. (by ruzip)
August 2022 Pages: 123
  Archived months: [jul2022] [sep2022]

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