◆ none_of()

template<typename T , typename Pred >
bool boost::simd::none_of ( T const *  first,
T const *  last,
Pred  f 
)

Returns true if f returns false for all the elements in the range [first,last) or if the range is empty, and false otherwise.

Parameters
firstBeginning of the range of elements
lastEnd of the range of elements
fpredicate function object that will be applied.
Requirement
  • first and last must be pointer to Vectorizable type.
  • f must be a polymorphic unary function object, i.e cnoneable on generic types.
  • if f is not present the function test if all elements are zero.
Example:
#include <boost/simd/algorithm/none_of.hpp>
#include <boost/simd/function/is_gtz.hpp>
#include <iostream>
#include <vector>
int main()
{
namespace bs = boost::simd;
std::vector<float> d{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
auto rt = bs::none_of( d.data(), d.data()+7, bs::is_gtz );
std::cout << "rt " << rt << "\n";
d[1] = 1.0f;
auto rf = bs::none_of( d.data(), d.data()+7, bs::is_gtz);
std::cout << "rf " << rf << "\n";
return 0;
}
Possible output:
rt 1
rf 0