General C++ Programming (Page 2)

same function name different signature
 
Why the following code does not compile in g++? struct A { int foo(int x) { return x *...
[3 replies] Last: Can also specify to use foo() in A explicitly: struct A { int foo(... (by seeplus)
output read string between getchar() calls
 
Hello mates, i dont understand what my code is doning and why. #include <iostream> int main() {...
[8 replies] Last: if i replace getchar() with getch() from conio.h, i dont get any key ... (by seeplus)
by Cplusc
if condition for class constructor
 
I'm trying to have a class constructor in an if condition but the compiler dos not accept that. here...
[2 replies] Last: Ops,you're right. I should've used macro instead of if condition.Thank... (by Cplusc)
by wk1999
asio coroutine timer
 
I am being confused the asio::timer coroutine does not work if I modify the timer in another corouti...
[2 replies] Last: The timer will expire in function bar: timer.expires_after(asio::chron... (by wk1999)
std::string to std::ifstream
 
I want std::string to be converted to std::ifstream Here is the code written, but unfortunately n...
[2 replies] Last: This will create the required vector, display the file names as the ve... (by seeplus)
main() trailing return type
 
int main() { } with Clang produces the warning message: <source>:1:5: warning: use a...
[13 replies] Last: where are C++ students going to get people to do their homework for t... (by seeplus)
by ruzip
Get the last argument of varying argument macro function
 
Is it possible to get the last argument of a macro function with varying argument count Somethi...
[2 replies] Last: I think you want to move the last element to the front, right? e.g., ... (by mbozzi)
Permutation of withdrawing 2 balls out of 5
 
I hope if there is someone have the time to read and help me to solve this problem. I stopped doing ...
[10 replies] Last: Heh, it isn't as if someone looking for help in the past hasn't genera... (by George P)
Upcasting and downcasting
 
Derived d1; Base* BasePtr = &d1; Base& BaseRef = d1; Derived* d2 = new Derived Base* BasePtr2...
[5 replies] Last: Thank you for clarifying my doubts! (by Worldtreeboy)
by frek
CTAD and concepts in C++20
 
Hi all, hope you're all very good. Stroustrup says: "Whenever possible use named concepts (e.g., st...
[2 replies] Last: So to answer my questions: 1) We had better use standard concepts not ... (by frek)
Hit a wall trying to implement radix sort
 
So I have been tasked with implementing a radix sort for school, and while the professor left commen...
[2 replies] Last: As this is now ticked, has the problem been solved? (by seeplus)
by ruzip
C Nested Linked list using dot for members
 
Is it possible to have a nested linked list in C using dot operator like structs to access members...
[8 replies] Last: @Keskiverto @GeorgeP Yes something like that. I'd prefer the dot typ... (by ruzip)
remove element from vector <struct>
 
Hell all , Please how can remove element from this vector [parr1 ] #include <iostream> #include <...
[6 replies] Last: And should you ever need it C++20 makes it possible to reverse a range... (by George P)
by ruzip
Check if function argument is a string
 
How do I check if an arg extracted from va_arg inside a function is a string? My function has var...
[6 replies] Last: Thanks for the input guys. I'm not really leaning into using variadic... (by ruzip)
by ruzip
C Macro Filter String literals in arguments
 
Is it possible to do a parse or filter in C a macro for example: FILTER(Var, "text", somevar, foo...
[7 replies] Last: The problem is that string literals are typically treated as being sel... (by mbozzi)
implementation of simple class for raspberry pi pwm blink program (Embedded Programming) (1,2)
 
Hi guys, Please, could you help me with this? I have been working on this simple project to make th...
[35 replies] Last: @seeplus: Thanks! :) (by ayoesquire)
by ruzip
Macro to replace comma in #define
 
I'm trying to do some C macro experiment where comma "," is replaced with a keyword like ADD Exam...
[11 replies] Last: Thanks mbozzi , it works great! problem solved 👍 I did try someth... (by ruzip)
by Cplusc
shared pointer
 
I'm trying to use shared pointer in my code as follows, enum BoundaryType { PressureInlet, Pres...
[9 replies] Last: thanks for your help. (by Cplusc)
by ruzip
Parsing Include Files Recursively
 
I need a C function that I can parse files recursively like a tree inside a file with a pattern impo...
[19 replies] Last: Thanks seeplus ! (by ruzip)
Function to output all combinations that give a certain value
 
I have two vectors _A and _B and an equation (x-y)/2, where the x is vector _A and y is _B. So for e...
[3 replies] Last: Not sure that I agree with your model output: #include <iostream> #i... (by lastchance)
Pages: 123
  Archived months: [jan2023]

Cannot post in this page. To post a new message, go to the first page.