Skip to content
Permalink
Browse files

Vector [2|3]: Allow passing temporary to conversion constructor

  • Loading branch information...
Dgame committed Apr 15, 2015
1 parent b2d7da6 commit eb7641e6a1775fdf9e804c44b15bfd226ec567c0
@@ -66,7 +66,7 @@ struct Vector2(T) if (isNumeric!(T)) {
* CTor
*/
@nogc
this(U)(ref const Vector2!(U) vec) pure nothrow if (!is(U == T)) {
this(U)(auto ref const Vector2!(U) vec) pure nothrow if (!is(U == T)) {
this(vec.x, vec.y);
}

@@ -290,4 +290,9 @@ unittest {

assert(vec5 / vec6 == vec7);
assert(vec5 / vec6.x == vec7);

const Vector2i vec8 = Vector2i(32, 32);
const Vector2f vec9 = (vec8 / 32) * 32;

assert(vec9.x == vec8.x && vec9.y == vec8.y);
}
@@ -62,7 +62,7 @@ struct Vector3(T) if (isNumeric!(T)) {
* CTor
*/
@nogc
this(U)(ref const Vector3!(U) vec) pure nothrow if (!is(U == T)) {
this(U)(auto ref const Vector3!(U) vec) pure nothrow if (!is(U == T)) {
this(vec.x, vec.y, vec.z);
}

@@ -32,7 +32,7 @@ <h1>Dgame.Math.Vector2</h1>
<dd>CTor<br><br>

</dd>
<dt><big><a name="Vector2.this.3"></a>pure nothrow @nogc this(U)(ref const Vector2!U <i>vec</i>) if (!is(U == T));
<dt><big><a name="Vector2.this.3"></a>pure nothrow @nogc this(U)(auto ref const Vector2!U <i>vec</i>) if (!is(U == T));
</big></dt>
<dd>CTor<br><br>

@@ -37,7 +37,7 @@ <h1>Dgame.Math.Vector3</h1>
<dd>CTor<br><br>

</dd>
<dt><big><a name="Vector3.this.3"></a>pure nothrow @nogc this(U)(ref const Vector3!U <i>vec</i>) if (!is(U == T));
<dt><big><a name="Vector3.this.3"></a>pure nothrow @nogc this(U)(auto ref const Vector3!U <i>vec</i>) if (!is(U == T));
</big></dt>
<dd>CTor<br><br>

0 comments on commit eb7641e

Please sign in to comment.
You can’t perform that action at this time.