================
@@ -1888,6 +1888,35 @@ using MyTypeList = TypeList<__builtin_dedup_pack<int, 
double, int, char, double,
 - The resulting pack is currently only supported for expansion in template 
argument lists and base specifiers.
 - This builtin cannot be assigned to a template template parameter.
 
+### \_\_builtin_sort_pack
+
+```c++
+template <class... Ts>
+using __builtin_sort_pack = ...;
+```
+
+This alias takes a template parameter pack `Ts` and produces a new unexpanded 
pack containing the same types
+sorted by [`__builtin_type_order`](#builtin-type-order).
+
+The resulting pack can be expanded in contexts like template argument lists or 
base specifiers.
+
+**Example of Use**:
+
+```c++
+template <typename...> struct TypeList;
+
+// Combined with `__builtin_dedup_pack` to canonicalize a type list.
+template <typename ...ExtraTypes>
+using MyTypeList = TypeList<
+    __builtin_sort_pack<__builtin_dedup_pack<int, double, 
ExtraTypes...>...>...>;
----------------
erichkeane wrote:

Silly question: Does dedup_pack work like 'unique' in that it only removes 
'neighbor' dupes?  If so, should the sort/dedup be reversed?

https://github.com/llvm/llvm-project/pull/225025
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to