coord/ops: add `all' overload for scalar bool

This commit is contained in:
Danny Robson 2018-03-14 18:13:52 +11:00
parent deb787847c
commit bafe71b3ab

View File

@ -1269,6 +1269,18 @@ namespace util {
}
///------------------------------------------------------------------------
/// returns true if the value is true.
///
/// provided so that templates may operate with the same calls for vectors
/// and scalars. eg, all (t >= 0 && t <= 1) shold work for either type.
constexpr bool
all (bool val)
{
return val;
}
///------------------------------------------------------------------------
/// returns an instance of K elementwise using a when s is true, and b
/// otherwise. ie, k[i] = s[i] ? a[i] : b[i];