Message from C, C++ discussions

December 2019

— #howtoask

— 

Try phrasing your question like this:

1. Tell us the problem

2. Tell us what you have done so far.

3. Tell us how you got to this point

4. Paste code in pastebin or something similar

5. Wait for beautiful answers

— Hello everyone

— Is there anymethod to iterate over a struc member

— Struct A {
bool autenticated;
bool started;
bool enabled ;
A() {
autenticated = false;
started ⁼ false;
enabled = false;
}
}

Message permanent page

— How to iterate over this class

— Using a loop or something like that

— Why should you?

— C++ does not support reflections, so there is no standard way to do it

— Because i want to initiate a struct of socket using sun_family = AF_UNIX

— And then do memset

— Sadly, reflection postponed from C++20, so there's still no standard way, but some approaches available:
https://stackoverflow.com/questions/17660095/iterating-over-a-struct-in-c

Message permanent page