2
0
mirror of https://github.com/boostorg/compute.git synced 2026-02-19 02:12:19 +00:00

Add for_each_n() algorithm

This commit is contained in:
Kyle Lutz
2014-12-20 13:30:01 -08:00
parent 7c957831c3
commit 73b246603b
4 changed files with 48 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
#include <boost/compute/function.hpp>
#include <boost/compute/algorithm/iota.hpp>
#include <boost/compute/algorithm/for_each.hpp>
#include <boost/compute/algorithm/for_each_n.hpp>
#include <boost/compute/container/vector.hpp>
#include "context_setup.hpp"
@@ -30,4 +31,14 @@ BOOST_AUTO_TEST_CASE(for_each_nop)
bc::for_each(vector.begin(), vector.end(), nop, queue);
}
BOOST_AUTO_TEST_CASE(for_each_n_nop)
{
bc::vector<int> vector(4, context);
bc::iota(vector.begin(), vector.end(), 0);
BOOST_COMPUTE_FUNCTION(void, nop, (int ignored), {});
bc::for_each_n(vector.begin(), vector.size(), nop, queue);
}
BOOST_AUTO_TEST_SUITE_END()