General C++ Programming - March 2023 (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...
Mar 13, 2023 at 5:47am
[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...
Mar 11, 2023 at 3:25pm
[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) { ...
Mar 8, 2023 at 5:05pm
[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())...
Mar 8, 2023 at 4:54pm
[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....
Mar 7, 2023 at 7:52pm
[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...
Mar 6, 2023 at 8:42am
[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...
Mar 4, 2023 at 11:12am
[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...
Mar 3, 2023 at 10:52am
[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...
Mar 3, 2023 at 3:15am
[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...
Mar 2, 2023 at 4:02pm
[10 replies] Last: Heh, it isn't as if someone looking for help in the past hasn't genera... (by deleted account xyzzy)
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...
Mar 2, 2023 at 2:59am
[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...
Mar 1, 2023 at 4:15pm
[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 ...
Mar 1, 2023 at 10:18am
[2 replies] Last: As this is now ticked, has the problem been solved? (by seeplus)
March 2023 Pages: 12
  Archived months: [feb2023] [apr2023]

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