copy_if
#
Header File: Kokkos_StdAlgorithms.hpp
namespace Kokkos{
namespace Experimental{
template <
class ExecutionSpace, class InputIteratorType, class OutputIteratorType, class UnaryPredicateType
>
OutputIteratorType copy_if(const ExecutionSpace& exespace, (1)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_to,
UnaryPredicateType pred);
template <
class ExecutionSpace, class InputIteratorType, class OutputIteratorType, class UnaryPredicateType
>
OutputIteratorType copy_if(const std::string& label,
const ExecutionSpace& exespace, (2)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_to,
UnaryPredicateType pred);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class UnaryPredicateType
>
auto copy_if(const ExecutionSpace& exespace, (3)
const Kokkos::View<DataType1, Properties1...>& view_from,
const Kokkos::View<DataType2, Properties2...>& view_to,
UnaryPredicateType pred);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class UnaryPredicateType
>
auto copy_if(const std::string& label, const ExecutionSpace& exespace, (4)
const Kokkos::View<DataType1, Properties1...>& view_from,
const Kokkos::View<DataType2, Properties2...>& view_to,
UnaryPredicateType pred);
} //end namespace Experimental
} //end namespace Kokkos
Description#
Copies the elements for which pred
returns true
from range [first_from, last_from)
to another range beginning at first_to
(overloads 1,2) or from view_from
to view_to
(overloads 3,4).
Parameters and Requirements#
exespace
,first_from
,last_from
,first_to
,view_from
,view_to
:same as in
copy
label
:for 1, the default string is: “Kokkos::copy_if_iterator_api_default”
for 3, the default string is: “Kokkos::copy_if_view_api_default”
pred
:unary predicate which returns
true
for the required element;pred(v)
must be valid to be called from the execution space passed, and convertible to bool for every argumentv
of type (possible const)value_type
, wherevalue_type
is the value type ofInputIteratorType
(for 1,2) or ofview_from
(for 3,4), and must not modifyv
.should have the same API as the unary predicate in
replace_if
Return#
Iterator to the destination element after the last element copied.