40 #ifndef ECUDA_ALGO_FOR_EACH_HPP
41 #define ECUDA_ALGO_FOR_EACH_HPP
46 #include "../global.hpp"
47 #include "../iterator.hpp"
54 template<
class InputIterator,
class UnaryFunction>
56 for_each( InputIterator first, InputIterator last, UnaryFunction f, ecuda::false_type )
66 template<
class InputIterator,
class UnaryFunction>
68 for_each( InputIterator first, InputIterator last, UnaryFunction f, ecuda::true_type )
71 while( first != last ) { f(*first); ++first; }
74 typedef typename ecuda::remove_const<typename ecuda::iterator_traits<InputIterator>::value_type>::type value_type;
75 std::vector< value_type, host_allocator<value_type> > v(
ecuda::distance(first,last) );
87 template<
class InputIterator,
class UnaryFunction>
89 for_each( InputIterator first, InputIterator last, UnaryFunction f )
__HOST__ __DEVICE__ OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result)
Replacement for std::copy.
ecuda::false_type is_device_iterator
ECUDA_SUPPRESS_HD_WARNINGS __HOST__ __DEVICE__ UnaryFunction for_each(InputIterator first, InputIterator last, UnaryFunction f)
#define ECUDA_SUPPRESS_HD_WARNINGS
ECUDA_SUPPRESS_HD_WARNINGS __HOST__ __DEVICE__ std::iterator_traits< Iterator >::difference_type distance(const Iterator &first, const Iterator &last)