This is about std::is_pod
, which detects whether a template is a plain old data type or not.
See the following code:
struct A { public: int m1; int m2; }; struct B { public: int m1; private: int m2; }; struct C { private: int m1; int m2; }; int main() { std::cout << std::boolalpha; std::cout << std::is_pod<A>::value << '\n'; // true std::cout << std::is_pod<B>::value << '\n'; // false std::cout << std::is_pod<C>::value << '\n'; // true }
The 3 structs all look like POD to me. But apparently struct B
is not. I don't understand why. To me, they all have a trivial constructor, move and copy operator. Destructor is certainly trivial too.
I blame it on using 2 access specifiers, but I can't find information about this.
What is a Pod? Pods are the smallest, most basic deployable objects in Kubernetes. A Pod represents a single instance of a running process in your cluster. Pods contain one or more containers, such as Docker containers.
countable noun. A pod is a seed container that grows on plants such as peas or beans. ...
Pods are designed to support multiple cooperating processes (as containers) that form a cohesive unit of service. The containers in a Pod are automatically co-located and co-scheduled on the same physical or virtual machine in the cluster.
A pod or a cluster is simply a set of computers linked by high-speed networks into a single unit. Computer architects must have reached, at least unconsciously, for terms rooted in nature. Pea pods and dolphin superpods, like today's computer clusters, show the power of many individuals working as a team.
According to the standard (9 Classes [class], emphasis mine):
A standard-layout class is a class that:
...
— has the same access control (Clause 11) for all non-static data members,
...
and
A POD struct is a non-union class that is both a trivial class and a standard-layout class, and ...
Your hunch is correct, because B.m1
and B.m2
are both non-static and have different access control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With