Vector.opEquals

Comparisson Operator

struct Vector(type, int dim)
nothrow @nogc pure nothrow @nogc pure nothrow @nogc @safe const
bool
opEquals
(
T
)
(
T vec
)
if (
T.dimension == dimension
)
if (
(dim >= 2) &&
(dim <= 4)
)

Examples

Unittest Comparisson Operator

assert( vec2( 1.0f, 2.0f ) == vec2( 1.0f, 2.0f ));
assert( vec2( 1.0f, 2.0f ) != vec2( 1.0f, 1.0f ));
assert( vec2( 1.0f, 2.0f ) == vec2d( 1.0, 2.0 ));
assert( vec2( 1.0f, 2.0f ) != vec2d( 1.0, 1.0 ));

assert( vec3( 1.0f, 2.0f, 3.0f ) == vec3( 1.0f, 2.0f, 3.0f ));
assert( vec3( 1.0f, 2.0f, 3.0f ) != vec3( 1.0f, 2.0f, 2.0f ));
assert( vec3( 1.0f, 2.0f, 3.0f ) == vec3d( 1.0, 2.0, 3.0 ));
assert( vec3( 1.0f, 2.0f, 3.0f ) != vec3d( 1.0, 2.0, 2.0 ));

assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) == vec4( 1.0f, 2.0f, 3.0f, 4.0f ));
assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) != vec4( 1.0f, 2.0f, 3.0f, 3.0f ));
assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) == vec4d( 1.0, 2.0, 3.0, 4.0 ));
assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) != vec4d( 1.0, 2.0, 3.0, 3.0 ));

assert( !( vec4( float.nan )));
if ( vec4( 1.0f )) {}
else {  assert( false );  }

Meta