General C++ Programming - November 2020

What is the reason for the explicit template specification order / special status of first argument?
I started experimenting with the C++20 feature of concepts and was very pleased when I realized that it is possible to partially explicitly provide template arg...
Nov 30, 2020 at 7:51pm
[1 reply] : this was already discussed in http://cplusplus.com/forum/general/2744... (by Cubbi)
I am having trouble with this problem. I am stuck.
 You will be using a data file called “christmas.dat”. To copy the data file to your directory, do cp /export/home/public/may/christmas.dat christmas....
Nov 30, 2020 at 6:34pm
[1 reply] : I am having trouble with this problem. I am stuck. Stuck at what po... (by seeplus)
Linked list removing problem [repost from r cplusplus]
Hello, here I have a program which takes in the head of a linked list and the value that I want the node removed. It successfully removes and returns the head i...
Nov 30, 2020 at 6:28pm
[2 replies] Last: Using a prev pointer: for (Node *current=head, *prev=nullptr; cur... (by dhayden)
by dman25
Create new object with std::async
Is there a way to call a constructor and create a new object with std::async?
Nov 30, 2020 at 11:45am
[3 replies] Last: Oh yeah. Or you could just return it. (by Repeater)
3D camera: i need a correction on camera size
how can i use the camera size for the window size: camera1.size.Height = Me.ScaleHeight + 100 camera1.size.Width = Me.ScaleWidth camera1.Position.X ...
Nov 30, 2020 at 11:30am
[16 replies] Last: I don't have VB. But you can easily check your code in two ways: 1. T... (by againtry)
by BZKN
calculate size of the data from function arguments
Hi, I am struggling to understand how to calculate the size of the data in a function given its function arguments. For example below is the function foo ...
Nov 30, 2020 at 11:12am
[1 reply] : It passes 2 pointers and 2 ints, therefore the size of the data passed... (by seeplus)
linking node at the end of the list
Hi all, I tried to link a new node(NewNode) at the end of the list but it is not executing the last statement (last->next = NewNode). Could you guys help me to ...
Nov 30, 2020 at 6:30am
[2 replies] Last: Thank you for the information, it's really helpful. Now, I'm able to l... (by hakmaabdul)
Why is __cplusplus defined within extern “C”
Within extern "C" { } the macro __cplusplus is still defined. When I want to include the C version of mpi.h in the header of my library which is dynamically loa...
Nov 30, 2020 at 6:13am
[1 reply] : You forgot to extern "C" the definition of library_do(), thus the func... (by helios)
Is this name collision?
The error was "no instance of overloaded function "people::people" matches the specified type" on the first line of code of my C++ file. People::people... I inc...
Nov 29, 2020 at 5:32pm
[5 replies] Last: This compiles and runs OK as 1 file: #include <string> #include <io... (by seeplus)
by Bapt
Create an histogram from datas vector
Hi Everybody, I would like to print a histogram from datas vector. My vector is composed of a 256 index and each index counts the number of gray scale le...
Nov 29, 2020 at 3:06pm
[8 replies] Last: Thanks for all !! (by Bapt)
Help with Implementing a class please
I need to write an application, which reads two times and finds out which time is later. After that it calculates the time difference between these times ...
Nov 29, 2020 at 2:48pm
[2 replies] Last: Double posting: http://www.cplusplus.com/forum/windows/274453/ (by deleted account xyzzy)
C++20: concept definition parameters seems inverted
Hi, This next concept: template <class T, class U> concept SubClass = std::is_base_of<U, T>::value; used in this context: template<SubCla...
Nov 28, 2020 at 7:47pm
[1 reply] : Looks like that "SubClass" was someone's version of the standard libra... (by Cubbi)
TLE
Hello, can somebody help me, I wrote a code that calculates a^b and then finds how many digits does that number have, but I have a problem when I put 2 numbers ...
Nov 28, 2020 at 3:48pm
[4 replies] Last: that too. but you fixed that already :) If the OP is going to be pla... (by jonnin)
std:: or using namespace std
Why so many people use std:: instead of just writing using namespace std at the top?
Nov 28, 2020 at 2:47pm
[6 replies] Last: There are a lot of names in the std:: namespace. If put using namespac... (by dhayden)
by Mante
What do I need to know when mixing C and C++ code?
// C++ code extern "C" void f(int); // one way extern "C" { // another way int g(double); double h(); }; void code(int i, do...
Nov 28, 2020 at 9:16am
[1 reply] : https://isocpp.org/wiki/faq/mixing-c-and-cpp (by salem c)
Weird compiler behavior
Recently I have stumbled across a piece of code, that puzzles me, because different compilers compile it in a different way: #include <iostream> using names...
Nov 28, 2020 at 1:07am
[2 replies] Last: The problem is one of evaluation order , not operator precedence: it ... (by mbozzi)
Beginner Level Pointer
#include <stdio.h> #include <cmath> void update(int *a,int *b) { // Complete this function *a+=*b; *b=abs(*a-2**b); } To calculate b...
Nov 27, 2020 at 7:18pm
[6 replies] Last: @furry guy Suppose be C++. I was doing some C++ practices for some r... (by junweinehc)
replacing a character in a string
Hi How can i replace a character from a introduced string? let's say i introduce "aabcf" i want to replace all a leters with b , so i introduce from the keyboar...
Nov 27, 2020 at 5:17pm
[9 replies] Last: OK #include <string> #include <iostream> #include <map> int main()... (by seeplus)
Reapating numbers
Hello, I got a task to do in my university studies, and I don't have any idea how to do it,may somebody help me ? So the task is to make an array and make a pro...
Nov 27, 2020 at 3:40pm
[5 replies] Last: That's one part of the answer - how about the rest? In this sequence ... (by lastchance)
by vish09
Threads accessing same buffer
I have a big buffer that I want to share between threads, each thread will always be reading from different parts of the buffer (never from the same part), so s...
Nov 27, 2020 at 1:03pm
[3 replies] Last: Thanks for clearing my doubts. (by vish09)
November 2020 Pages: 123... 7
  Archived months: [oct2020] [dec2020]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.