Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #71536 > unrolled thread
| Started by | Daniel <danielaparker@gmail.com> |
|---|---|
| First post | 2020-01-23 22:17 -0800 |
| Last post | 2020-01-25 00:07 -0500 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.c++
is_standard_layout vs is_pod Daniel <danielaparker@gmail.com> - 2020-01-23 22:17 -0800
Re: is_standard_layout vs is_pod Bo Persson <bo@bo-persson.se> - 2020-01-24 10:14 +0100
Re: is_standard_layout vs is_pod James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-25 00:07 -0500
| From | Daniel <danielaparker@gmail.com> |
|---|---|
| Date | 2020-01-23 22:17 -0800 |
| Subject | is_standard_layout vs is_pod |
| Message-ID | <856b47d8-fdfd-4167-9c01-587b59bafe7f@googlegroups.com> |
Can someone explain what is the difference between is_standard_layout and is_pod, and why the latter is being deprecated in 2020? Thanks, Daniel
[toc] | [next] | [standalone]
| From | Bo Persson <bo@bo-persson.se> |
|---|---|
| Date | 2020-01-24 10:14 +0100 |
| Message-ID | <h8vqsdFiteaU1@mid.individual.net> |
| In reply to | #71536 |
On 2020-01-24 at 07:17, Daniel wrote:
> Can someone explain what is the difference between is_standard_layout and is_pod, and why the latter is being deprecated in 2020?
>
The is_pod tests several conditions that have been separated into
is_standard_layout and is_trivial.
So, is_pod is no longer used by the standard library (except as the
deprecated type trait).
Bo Persson
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2020-01-25 00:07 -0500 |
| Message-ID | <r0gieq$f81$1@dont-email.me> |
| In reply to | #71536 |
On 1/24/20 1:17 AM, Daniel wrote: > Can someone explain what is the difference between is_standard_layout and is_pod, and why the latter is being deprecated in 2020? "Scalar types, POD classes (Clause 9), arrays of such types and cv-qualified versions of these types (3.9.3) are collectively called POD types. ... Scalar types, standard-layout class types (Clause 9), arrays of such types and cv-qualified versions of these types (3.9.3) are collectively called standard-layout types." (3.9p9) Scalar types are, by definition, both POS type and standard-layout types. Therefore, it's only for classes that there's a difference. "A POD struct 109 is a non-union class that is both a trivial class and a standard-layout class, and has no non-static data members of type non-POD struct, non-POD union (or array of such types). Similarly, a POD union is a union that is both a trivial class and a standard-layout class, and has no non-static data members of type non-POD struct, non-POD union (or array of such types). A POD class is a class that is either a POD struct or a POD union." (9p10). A POD class is by definition a standard-layout class, but the reverse is not true. A standard-layout class that is non-trivial or has non-static non-POD data members will not qualify as a POD class. Things that could make a standard-layout class non-trivial include (9p6): 1. A missing default ctor. 2. A non-trivial default constructor. 3. Not trivially copyable Thing that would prevent a standard-layout class from being trivially copyable include (9p6): 1. a non-trivial copy ctor 2. a non-trivial move ctor 3. a non-trivial copy assignment operator 4. a non-trivial move constructor 5. a non-trivial dtor. A user-provided function is never trivial, and the same rules apply recursively to both base classes and non-static data members (12.1p4, 12.4p5, 12.8p12, 12.8p25). Note that POD classes can have base classes, static data members, and member functions. A standard-layout class can have all of those things and non-trivial special member functions.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web