General C++ Programming - February 2023

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)
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 import "anyfilename.anyextension". The results will be stored i...
[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 example _A={8,1,16} and B={4,1,8} my output should be all the...
[3 replies] Last: Not sure that I agree with your model output: #include <iostream> #i... (by lastchance)
by PeteDD
passing char and returning 1-wire DeviceAddress
I am working on a config.ini parser combined with a class that manages sensors in a large data collection system. One type of sensors we are using are 1-Wire w...
[2 replies] Last: Thank you Ganado for the good insights that will help me. The address ... (by PeteDD)
C++ 20, designated initializers This is one very nice C++ feature, increasing readability. Always a good ...
[13 replies] Last: Yeah I meant braces. But, okay now I get it. The assignment is the exp... (by Ganado)
by frek
When do you use 'auto' in your code
auto seems to be vey powerfull and flexible like a template. It's possible to use it instead of a long name of the left hand side of an initialization operato...
[8 replies] Last: What do you guys think of the version used in PS2 in my first post? ... (by MikeyBoy)
string_view is a borrowed range but it can still dangle
I thought iterators to borrowed ranges could not dangle! Because of it being a borrowed_range??? The text says iterators can still dangle when the underlyin...
[1 reply] : [quote=cppreference]The concept borrowed_range defines the requirement... (by Peter87)
by IsaacD
Why doesn't GNU add famous non-standard functions to glibc?
I recently found out that certain non-standard C functions, such as itoa() and strrev() are not available in gcc but are available on other compilers such as MS...
[16 replies] Last: visual provides it anyway, both getch(e) & kbhit (and probably newer o... (by jonnin)
Can somebody explain what is a borrowed_range?
the text reads iterators of borrowed ranges can sill be used when the range itself no longer exists ???
[1 reply] : A borrowed range is one whose iterator validity doesn't rely on the li... (by seeplus)
How to initialize an array whose size is initially unknown
Hello all , Note: These values[xup -yup -xright - etc ..] are constantly changing My example .. #include <iostream> int main() { int xup = 721 ; int yup...
[10 replies] Last: Thanks all , seeplus , jonnin , doug4 Thank you very much for your gre... (by Hawlong)
Multithreading in a dll
I wanted to make two functions running in the background at the same time inside dll My dll #include <Windows.h> #include <iostream> DWORD WINAPI MainT...
[6 replies] Last: You have made a great effort for my sake, thank your (by Hawlong)
Read / Write Array Of Byte (1,2,3)
Hello all , Please how can read , Array Of Byte (cheat engine). using c ++ (internal)
[40 replies] Last: Calling a class method on a nullptr is seemingly allowed by MSVC and G... (by George P)
  Archived months: [jan2023] [mar2023]

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