During coding of std::atomic, CAS, etc, I always struggle to memorize the definition of CPP class being "TriviallyCopyable".
Now I am gradually switching to C world, I accidentally found that most, if not all, scenarios where I deem one class to be TrivialCopyable is effectively a C struct. And the requirements described in the link above indeed looks like a C struct by me.
Is it? what did I miss?
N.B. of course C struct is public by default, etc, but let's just ignore those relatively irrelevant features, instead, my guess is whatever deemed to be TriviallyCopyable in CPP can be made in C by struct, with no hard hacking involved.
struct A { int a; static int b; };is trivially copyable, but not a valid C struct.template<std::integral T> struct my_struct { T data; };, trivially copyable but yet... not a "C" struct