View source code
Display the source code in std/traits.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.traits.isInnerClass
Determines whether T
is a class nested inside another class
and that T
is the implicit reference to the outer class
(i.e. outer
has not been used as a field or method name)
enum isInnerClass(T)
= __traits(isSame, typeof(T .outer), __traits(parent, T)) && (staticIndexOf!(__traits(allMembers, T), "outer") == -1);
Parameters
Name | Description |
---|---|
T | type to test |
Returns
true
if T
is a class nested inside another, with the conditions described above;
false
otherwise
Example
class C
{
int outer;
}
static assert(!isInnerClass!C);
class Outer1
{
class Inner1 { }
class Inner2
{
int outer;
}
}
static assert(isInnerClass!(Outer1 .Inner1));
static assert(!isInnerClass!(Outer1 .Inner2));
static class Outer2
{
static class Inner
{
int outer;
}
}
static assert(!isInnerClass!(Outer2 .Inner));
Authors
Walter Bright,
Tomasz Stachowiak (isExpressions
),
Andrei Alexandrescu,
Shin Fujishiro,
Robert Clipsham,
David Nadlinger,
Kenji Hara,
Shoichi Kato
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.