View source code
Display the source code in std/meta.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Enum member std.meta.aliasSeqOf
Converts any foreach-iterable entity (e.g. an input range) to an alias sequence.
enum aliasSeqOf(alias iter)
= Impl .init .tupleof;
Parameters
Name | Description |
---|---|
iter | the entity to convert into an AliasSeq . It must be able to be able to be iterated over using
a foreach-statement. |
Returns
An AliasSeq
containing the values produced by iterating over iter
.
Example
import std .algorithm .iteration : map;
import std .algorithm .sorting : sort;
import std .string : capitalize;
struct S
{
int a;
int c;
int b;
}
alias capMembers = aliasSeqOf!([__traits(allMembers, S)] .sort() .map!capitalize());
static assert(capMembers[0] == "A");
static assert(capMembers[1] == "B");
static assert(capMembers[2] == "C");
Example
static immutable REF = [0, 1, 2, 3];
foreach (I, V; aliasSeqOf!([0, 1, 2, 3]))
{
static assert(V == I);
static assert(V == REF[I]);
}
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.