View source code
Display the source code in std/traits.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla 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 usinglocal clone.
Enum member std.traits.hasUnsharedAliasing
Returns true
if and only if T
's representation includes at
least one of the following:
- a raw pointer
U*
andU
is not immutable or shared; - an array
U[]
andU
is not immutable or shared; - a reference to a class type
C
andC
is not immutable or shared. - an associative array that is not immutable or shared.
- a delegate that is not shared.
enum hasUnsharedAliasing(T...) = anySatisfy!(hasUnsharedAliasingImpl, T);
Example
struct S1 { int a; Object b; }
struct S2 { string a; }
struct S3 { int a; immutable Object b; }
static assert( hasUnsharedAliasing!S1);
static assert(!hasUnsharedAliasing!S2);
static assert(!hasUnsharedAliasing!S3);
struct S4 { int a; shared Object b; }
struct S5 { char[] a; }
struct S6 { shared char[] b; }
struct S7 { float[3] vals; }
static assert(!hasUnsharedAliasing!S4);
static assert( hasUnsharedAliasing!S5);
static assert(!hasUnsharedAliasing!S6);
static assert(!hasUnsharedAliasing!S7);
Application output
Running...
Authors
Walter Bright,
Tomasz Stachowiak (isExpressions
),
Andrei Alexandrescu,
Shin Fujishiro,
Robert Clipsham,
David Nadlinger,
Kenji Hara,
Shoichi Kato
License
Copyright © 1999-2025 by the D Language Foundation | Page generated by ddox.