all

check whether all elements of a boolean vector are true

Declaration

  • bool all(bvec2 x)
  • bool all(bvec3 x)
  • bool all(bvec4 x)

Parameters

  • x: Specifies the vector to be tested for truth.

Description

all returns true if all elements of x are true and false otherwise. It is functionally equivalent to:

1bool all(bvec x)       // bvec can be bvec2, bvec3 or bvec4
2    {
3        bool result = true;
4        int i;
5        for (i = 0; i < x.length(); ++i)
6        {
7            result &= x[i];
8        }
9        return result;
10    }

See Also