General C++ Programming (Page 2)

Boost logging library
 
may i please inquire re/ Boost logging library . a cursory reading of the manual indicates it merely stores strings of the programmer's choosing . i wish to uti...
[2 replies] Last: This is one kind of workflow where you might want to record inputs to ... (by salem c)
Undefined reference when using generics
 
Recently my class started to dig deeper into working with generics and templates for Java. Since I'm still learning C++, I thought it would be a nice learning e...
[3 replies] Last: You're not using generics. Generics are a different concept in other H... (by IWishIKnew)
same function name different signature
 
Why the following code does not compile in g++? struct A { int foo(int x) { return x * 2; } }; struct B: A { int foo(int x, int y) { ...
[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() { std::string msg; int c; while ((c = getchar())...
[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 is the code, LattModel::LattModel() :VelocitySet( { 4....
[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 coroutine: The "Leave foo" never reached: Enter foo Enter ba...
[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 not working :( ifstream fileList("/home/viraj/Docu...
[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 trailing return type for this function [modernize-use-trail...
[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 Something like: #define foo(...,var)(var __VA_ARGS__) but thi...
[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 programming for a very long time. I am a freelance C++ prog...
[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 = d2; During upcasting, Am I upcasting the derived cl...
[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., standard-library concepts)", but I have a guess for the time b...
[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 comments explaining how to implement, and I feel I understand the ...
[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? Should be able to create new instances using loops
[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 <string> #include <vector> using std::cout; using std::endl;...
[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 variable number of args.
[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, "moretext") Becomes or expands to: FILTER(Var, somev...
[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 the LED blink which is hooked onto the GPIO pins of a RPi 4 us...
[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 Example: #define ADD , int Sum(int a, int b, int c) { re...
[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, PressureOutlet, VelocityInlet, VelocityOutlet, ZouHe }; vo...
[9 replies] Last: thanks for your help. (by Cplusc)
Pages: 123
  Archived months: [jan2023]

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