Vector.opEquals

Comparisson Operator

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

Examples

Unittest Comparisson Operator

1 assert( vec2( 1.0f, 2.0f ) == vec2( 1.0f, 2.0f ));
2 assert( vec2( 1.0f, 2.0f ) != vec2( 1.0f, 1.0f ));
3 assert( vec2( 1.0f, 2.0f ) == vec2d( 1.0, 2.0 ));
4 assert( vec2( 1.0f, 2.0f ) != vec2d( 1.0, 1.0 ));
5 
6 assert( vec3( 1.0f, 2.0f, 3.0f ) == vec3( 1.0f, 2.0f, 3.0f ));
7 assert( vec3( 1.0f, 2.0f, 3.0f ) != vec3( 1.0f, 2.0f, 2.0f ));
8 assert( vec3( 1.0f, 2.0f, 3.0f ) == vec3d( 1.0, 2.0, 3.0 ));
9 assert( vec3( 1.0f, 2.0f, 3.0f ) != vec3d( 1.0, 2.0, 2.0 ));
10 
11 assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) == vec4( 1.0f, 2.0f, 3.0f, 4.0f ));
12 assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) != vec4( 1.0f, 2.0f, 3.0f, 3.0f ));
13 assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) == vec4d( 1.0, 2.0, 3.0, 4.0 ));
14 assert( vec4( 1.0f, 2.0f, 3.0f, 4.0f ) != vec4d( 1.0, 2.0, 3.0, 3.0 ));
15 
16 assert( !( vec4( float.nan )));
17 if ( vec4( 1.0f )) {}
18 else {  assert( false );  }

Meta