File indexing completed on 2025-01-18 09:30:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_EXPERIMENTAL_CLAMP_RANGE_HPP
0012 #define BOOST_COMPUTE_EXPERIMENTAL_CLAMP_RANGE_HPP
0013
0014 #include <iterator>
0015
0016 #include <boost/compute/lambda.hpp>
0017 #include <boost/compute/algorithm/transform.hpp>
0018
0019 namespace boost {
0020 namespace compute {
0021 namespace experimental {
0022
0023 template<class InputIterator, class OutputIterator>
0024 inline OutputIterator
0025 clamp_range(InputIterator first,
0026 InputIterator last,
0027 OutputIterator result,
0028 typename std::iterator_traits<InputIterator>::value_type lo,
0029 typename std::iterator_traits<InputIterator>::value_type hi,
0030 command_queue &queue)
0031 {
0032 using ::boost::compute::lambda::_1;
0033 using ::boost::compute::lambda::_2;
0034 using ::boost::compute::lambda::clamp;
0035
0036 return ::boost::compute::transform(
0037 first,
0038 last,
0039 result,
0040 clamp(_1, lo, hi),
0041 queue
0042 );
0043 }
0044
0045 }
0046 }
0047 }
0048
0049 #endif