Skip to content

Commit

Permalink
Merge pull request #2238 from jmdavis/rebindable
Browse files Browse the repository at this point in the history
Make Rebindable @trusted.
  • Loading branch information
monarchdodra committed Jun 12, 2014
2 parents f1f6b75 + 8f7e70c commit 5d202ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions std/typecons.d
Expand Up @@ -1075,29 +1075,29 @@ template Rebindable(T) if (is(T == class) || is(T == interface) || isDynamicArra
T original;
U stripped;
}
void opAssign(T another) pure nothrow
void opAssign(T another) @trusted pure nothrow
{
stripped = cast(U) another;
}
void opAssign(Rebindable another) pure nothrow
void opAssign(Rebindable another) @trusted pure nothrow
{
stripped = another.stripped;
}
static if (is(T == const U))
{
// safely assign immutable to const
void opAssign(Rebindable!(immutable U) another) pure nothrow
void opAssign(Rebindable!(immutable U) another) @trusted pure nothrow
{
stripped = another.stripped;
}
}

this(T initializer) pure nothrow
this(T initializer) @safe pure nothrow
{
opAssign(initializer);
}

@property ref inout(T) get() inout pure nothrow
@property ref inout(T) get() @trusted inout pure nothrow
{
return original;
}
Expand Down

0 comments on commit 5d202ea

Please sign in to comment.