Tuples: AliasSeq
Discover how to use AliasSeq in the D language for managing tuples comprising types and values. Explore its role in function arguments, template instantiation, and variadic templates. Understand how AliasSeq enables advanced tuple manipulation with indexing, slicing, and compile-time loop unrolling, preparing you to handle complex data structures efficiently.
We'll cover the following...
AliasSeq
AliasSeq is defined in the std.meta module. It is used for representing a concept that is normally used by the compiler but otherwise not available to the programmer as an entity, including a comma-separated list of values, types, and symbols (i.e., alias template arguments). The following are three examples of such lists:
-
Function argument list
-
Template argument list
-
Array literal element list
The following three lines of code are examples of these lists, respectively:
foo(1, "hello", 2.5); // function arguments
auto o = Bar!(char, long)(); // template
arguments auto a = [ 1, 2, 3, 4 ]; // array literal elements
Tuple takes advantage of AliasSeq when expanding its members.
The name AliasSeq comes from “alias sequence,” and it can contain types,
values, and ...