| 194 | queue |
| 195 | ); |
| 196 | CHECK_RANGE_EQUAL(int, 4, vector, (1, 9, 3, 9)); |
| 197 | |
| 198 | compute::copy( |
| 199 | data, data + 4, vector.begin(), queue |
| 200 | ); |
| 201 | |
| 202 | compute::transform( |
| 203 | vector.begin(), vector.end(), vector.begin(), |
| 204 | compute::bind(x_if_odd_else_y, 2, _1), |
| 205 | queue |
| 206 | ); |
| 207 | CHECK_RANGE_EQUAL(int, 4, vector, (1, 2, 3, 4)); |
| 208 | } |
| 209 | |
| 210 | BOOST_AUTO_TEST_CASE(bind_struct) |
| 211 | { |
| 212 | if(bug_in_struct_assignment(device)){ |
| 213 | std::cerr << "skipping bind_struct test" << std::endl; |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | BOOST_COMPUTE_FUNCTION(int, add_struct_value, (int x, data_struct s), |
| 218 | { |
| 219 | return s.int_value + x; |
| 220 | }); |
| 221 | |
| 222 | data_struct data; |
| 223 | data.int_value = 3; |
| 224 | data.float_value = 4.56f; |
| 225 | |
| 226 | int input[] = { 1, 2, 3, 4 }; |
| 227 | compute::vector<int> vec(input, input + 4, queue); |
| 228 | |
| 229 | compute::transform( |
| 230 | vec.begin(), vec.end(), vec.begin(), |
| 231 | compute::bind(add_struct_value, _1, data), |
| 232 | queue |
| 233 | ); |
| 234 | CHECK_RANGE_EQUAL(int, 4, vec, (4, 5, 6, 7)); |
| 235 | } |
| 236 | |
| 237 | BOOST_AUTO_TEST_SUITE_END() |
nothing calls this directly
no test coverage detected