[clang] [libcxx] [Clang] Add __common_type builtin (PR #99473)
A. Jiang via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 04:21:38 PDT 2024
================
@@ -1511,6 +1511,43 @@ Attributes (N2335) C2
``#embed`` (N3017) C23 C89, C++
============================================ ================================ ============= =============
+Builtin type aliases
+====================
+
+Clang provides a few builtin aliases to improve the throughput of certain metaprogramming facilities.
+
+__common_type
+-------------
+
+.. code-block:: c++
+ template <template <class... Args> class BaseTemplate,
+ template <class TypeMember> class HasTypeMember,
+ class HasNoTypeMember,
+ class... Ts>
+ using __common_type = ...;
+
+This alias is used for implementing ``std::common_type``. If ``std::common_type`` should contain a ``type`` member,
+it is an alias to ``HasTypeMember<TheCommonType>``. Otherwise it is an alias to ``HasNoTypeMember``. The
+``BaseTemplate`` is usually ``std::common_type``. ``Ts`` are the arguments to ``std::common_type``.
+
+__type_pack_element
+-------------------
+
+.. code-block:: c++
+ template <std::size_t Index, class... Ts>
+ using __type_pack_element = ...;
+
+This alias returns the type at ``Index`` in the parameter pack ``Ts``.
+
+__make_integer_seq
+------------------
+
+.. code-block:: c++
+ template <template <class IntSeqT, IntSeqT... Ints> class IntSeq, class T, class N>
----------------
frederick-vs-ja wrote:
```suggestion
template <template <class IntSeqT, IntSeqT... Ints> class IntSeq, class T, T N>
```
Typo?
https://github.com/llvm/llvm-project/pull/99473
More information about the cfe-commits
mailing list