|
286 | 286 |
|
287 | 287 | \begin{codeblock} |
288 | 288 | namespace std { |
| 289 | + template<class T> struct is_trivial; |
| 290 | + template<class T> constexpr bool is_trivial_v = is_trivial<T>::value; |
289 | 291 | template<class T> struct is_pod; |
290 | 292 | template<class T> constexpr bool is_pod_v = is_pod<T>::value; |
291 | 293 | template<size_t Len, size_t Align = @\exposid{default-alignment}@> // \seebelow |
|
304 | 306 | any of the templates defined in this subclause is undefined, |
305 | 307 | unless explicitly permitted by the specification of the corresponding template. |
306 | 308 |
|
| 309 | +\label{term.trivial.type}% |
| 310 | +A \defnadj{trivial}{class} is a class that is trivially copyable and |
| 311 | +has one or more eligible default constructors, all of which are trivial. |
| 312 | +\begin{note} |
| 313 | +In particular, |
| 314 | +a trivial class does not have virtual functions or virtual base classes. |
| 315 | +\end{note} |
| 316 | +A \defnadj{trivial}{type} is a scalar type, a trivial class, |
| 317 | +an array of such a type, or a cv-qualified version of one of these types.. |
| 318 | + |
307 | 319 | \pnum |
308 | 320 | \indextext{POD}% |
309 | 321 | A \term{POD class} is a class that is both a trivial class and a |
310 | 322 | standard-layout class, and has no non-static data members of type non-POD class |
311 | 323 | (or array thereof). A \term{POD type} is a scalar type, a POD class, an array |
312 | 324 | of such a type, or a cv-qualified version of one of these types. |
313 | 325 |
|
| 326 | +\indexlibraryglobal{is_trivial}% |
| 327 | +\begin{itemdecl} |
| 328 | +template<class T> struct is_trivial; |
| 329 | +\end{itemdecl} |
| 330 | + |
| 331 | +\begin{itemdescr} |
| 332 | +\pnum |
| 333 | +\expects |
| 334 | +\tcode{remove_all_extents_t<T>} shall be a complete type or \cv{} \keyword{void}. |
| 335 | + |
| 336 | +\pnum |
| 337 | +\remarks |
| 338 | +\tcode{is_trivial<T>} is a \oldconcept{UnaryTypeTrait}\iref{meta.rqmts} |
| 339 | +with a base characteristic of \tcode{true_type} |
| 340 | +if \tcode{T} is a trivial type, |
| 341 | +and \tcode{false_type} otherwise. |
| 342 | + |
| 343 | +\pnum |
| 344 | +\begin{note} |
| 345 | +It is unspecified |
| 346 | +whether a closure type\iref{expr.prim.lambda.closure} is a trivial type. |
| 347 | +\end{note} |
| 348 | +\end{itemdescr} |
| 349 | + |
314 | 350 | \indexlibraryglobal{is_pod}% |
315 | 351 | \begin{itemdecl} |
316 | 352 | template<class T> struct is_pod; |
|
0 commit comments