| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| "http://www.w3.org/TR/html4/strict.dtd"> |
| <!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ --> |
| <html> |
| <head> |
| <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>type traits intrinsic design</title> |
| <link type="text/css" rel="stylesheet" href="menu.css"> |
| <link type="text/css" rel="stylesheet" href="content.css"> |
| </head> |
| |
| <body> |
| <div id="menu"> |
| <div> |
| <a href="https://llvm.org/">LLVM Home</a> |
| </div> |
| |
| <div class="submenu"> |
| <label>libc++ Info</label> |
| <a href="/index.html">About</a> |
| </div> |
| |
| <div class="submenu"> |
| <label>Quick Links</label> |
| <a href="https://lists.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a> |
| <a href="https://lists.llvm.org/mailman/listinfo/cfe-commits">cfe-commits</a> |
| <a href="https://bugs.llvm.org/">Bug Reports</a> |
| <a href="https://github.com/llvm/llvm-project/tree/master/libcxx/">Browse Sources</a> |
| </div> |
| </div> |
| |
| <div id="content"> |
| <!--*********************************************************************--> |
| <h1>Type traits intrinsic design</h1> |
| <!--*********************************************************************--> |
| |
| <p> |
| This is a survey of the type traits intrinsics clang has, and those needed. |
| The names and definitions of several of the needed type traits has recently |
| changed. Please see: |
| <a href="https://wg21.link/n3142">N3142</a>. |
| </p> |
| |
| <blockquote> |
| <table border="1"> |
| <caption>Legend</caption> |
| |
| <tr> |
| <td>clang supplies it and it is absolutely necessary</td> |
| <td bgcolor="#80FF80"><tt>some_trait(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td>clang supplies it and it is useful</td> |
| <td bgcolor="#96B9FF"><tt>some_trait(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td>clang supplies it and it is not needed</td> |
| <td><tt>some_trait(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td>clang does not supply it and it is not needed</td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td>clang does not supply it and it is absolutely necessary</td> |
| <td bgcolor="#FF5965"><tt>some_trait(T)</tt></td> |
| </tr> |
| |
| </table> |
| |
| <p></p> |
| |
| <table border="1"> |
| <caption>Needed type traits vs clang type traits</caption> |
| |
| <tr> |
| <th>libc++ Needs</th> |
| <th>clang Has</th> |
| </tr> |
| |
| <tr> |
| <td><tt>is_union<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_union(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_class<T></tt></td> |
| <td bgcolor="#96B9FF"><tt>__is_class(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_enum<T></tt></td> |
| <td bgcolor="#96B9FF"><tt>__is_enum(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_pod<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_pod(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>has_virtual_destructor<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__has_virtual_destructor(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_constructible<T, Args...></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_default_constructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_copy_constructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_move_constructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_assignable<T, U></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_copy_assignable<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_move_assignable<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_destructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_constructible<T, Args...></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_trivially_constructible(T, U)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_default_constructible<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__has_trivial_constructor(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_copy_constructible<T></tt></td> |
| <td><tt>__has_trivial_copy(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_move_constructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_assignable<T, U></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_trivially_assignable(T, U)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_copy_assignable<T></tt></td> |
| <td><tt>__has_trivial_assign(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_move_assignable<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_destructible<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__has_trivial_destructor(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_constructible<T, Args...></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_default_constructible<T></tt></td> |
| <td><tt>__has_nothrow_constructor(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_copy_constructible<T></tt></td> |
| <td><tt>__has_nothrow_copy(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_move_constructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_assignable<T, U></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_copy_assignable<T></tt></td> |
| <td><tt>__has_nothrow_assign(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_move_assignable<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_nothrow_destructible<T></tt></td> |
| <td></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivial<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_trivial(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_trivially_copyable<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_trivially_copyable(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_standard_layout<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_standard_layout(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_literal_type<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_literal_type(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_convertible<T, U></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_convertible_to(T, U)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_base_of<T, U></tt></td> |
| <td bgcolor="#80FF80"><tt>__is_base_of(T, U)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>underlying_type<T></tt></td> |
| <td bgcolor="#80FF80"><tt>__underlying_type(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_polymorphic<T></tt></td> |
| <td><tt>__is_polymorphic(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_empty<T></tt></td> |
| <td><tt>__is_empty(T)</tt></td> |
| </tr> |
| |
| <tr> |
| <td><tt>is_abstract<T></tt></td> |
| <td><tt>__is_abstract(T)</tt></td> |
| </tr> |
| |
| </table> |
| </blockquote> |
| |
| </div> |
| </body> |
| </html> |