vec_is_equal

 

Description

Check if all elements in vector are equal

Syntax

bool vec_is_equal( const vector & vIn )

Parameters

vIn
[ input ] input vector

Return

If all elements in vector are equal, return true, else return false

Examples

EX1

void vec_is_equal_ex1()
{
    vector v1 = {1, 1, 1, 1};
    vector v2 = {0, 1, 1, 0};

    bool b1 = vec_is_equal(v1);
    bool b2 = vec_is_equal(v2);

    if (b1)
        printf ("v1 is equal\n");
    else
        printf ("v1 is not equal\n");
    if (b2)
        printf ("v2 is equal\n");
    else
        printf ("v2 is not equal\n");
}

Remark

See Also

ocmath_compare_data

header to Include

origin.h

Reference