Skip to content

Commit

Permalink
Renamed OutIter --> FwdIter (except for sequential code)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jul 8, 2017
1 parent 4c8cdde commit 736cb48
Show file tree
Hide file tree
Showing 16 changed files with 783 additions and 781 deletions.
78 changes: 39 additions & 39 deletions hpx/parallel/algorithms/adjacent_difference.hpp
Expand Up @@ -51,25 +51,25 @@ namespace hpx { namespace parallel { inline namespace v1
first, last, dest, std::forward<Op>(op));
}

template <typename ExPolicy, typename FwdIter, typename Op>
template <typename ExPolicy, typename FwdIter1, typename Op>
static typename util::detail::algorithm_result<
ExPolicy, Iter
>::type
parallel(ExPolicy && policy, FwdIter first, FwdIter last,
parallel(ExPolicy && policy, FwdIter1 first, FwdIter1 last,
Iter dest, Op && op)
{
typedef hpx::util::zip_iterator<FwdIter, FwdIter, Iter>
typedef hpx::util::zip_iterator<FwdIter1, FwdIter1, Iter>
zip_iterator;
typedef util::detail::algorithm_result<ExPolicy, Iter> result;
typedef typename std::iterator_traits<FwdIter>::difference_type
typedef typename std::iterator_traits<FwdIter1>::difference_type
difference_type;

if (first == last)
return result::get(std::move(dest));

difference_type count = std::distance(first, last) - 1;

FwdIter prev = first;
FwdIter1 prev = first;
*dest++ = *first++;

if (count == 0)
Expand Down Expand Up @@ -122,11 +122,11 @@ namespace hpx { namespace parallel { inline namespace v1
/// It describes the manner in which the execution
/// of the algorithm may be parallelized and the manner
/// in which it executes the assignments.
/// \tparam FwdIter The type of the source iterators used for the
/// \tparam FwdIter1 The type of the source iterators used for the
/// input range (deduced).
/// This iterator type must meet the requirements of an
/// forward iterator.
/// \tparam OutIter The type of the source iterators used for the
/// \tparam FwdIter2 The type of the source iterators used for the
/// output range (deduced).
/// This iterator type must meet the requirements of an
/// forward iterator.
Expand All @@ -151,10 +151,10 @@ namespace hpx { namespace parallel { inline namespace v1
/// within each thread.
///
/// \returns The \a adjacent_difference algorithm returns a
/// \a hpx::future<OutIter> if the execution policy is of type
/// \a hpx::future<FwdIter2> if the execution policy is of type
/// \a sequenced_task_policy or
/// \a parallel_task_policy and
/// returns \a OutIter otherwise.
/// returns \a FwdIter2 otherwise.
/// The \a adjacent_find algorithm returns an iterator to the
/// last element in the output range.
///
Expand All @@ -163,42 +163,42 @@ namespace hpx { namespace parallel { inline namespace v1
/// predicate \a op.
///

template <typename ExPolicy, typename FwdIter, typename OutIter>
template <typename ExPolicy, typename FwdIter1, typename FwdIter2>
inline typename std::enable_if<
execution::is_execution_policy<ExPolicy>::value,
typename util::detail::algorithm_result<ExPolicy, OutIter>::type
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
>::type
adjacent_difference(ExPolicy&& policy, FwdIter first, FwdIter last,
OutIter dest)
adjacent_difference(ExPolicy&& policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest)
{
typedef typename std::iterator_traits<FwdIter>::value_type value_type;
typedef typename std::iterator_traits<FwdIter1>::value_type value_type;

#if defined(HPX_HAVE_ALGORITHM_INPUT_ITERATOR_SUPPORT)
static_assert(
(hpx::traits::is_input_iterator<FwdIter>::value),
(hpx::traits::is_input_iterator<FwdIter1>::value),
"Requires at least input iterator.");
static_assert(
(hpx::traits::is_output_iterator<OutIter>::value ||
hpx::traits::is_forward_iterator<OutIter>::value),
(hpx::traits::is_output_iterator<FwdIter2>::value ||
hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least output iterator.");

typedef std::integral_constant<bool,
execution::is_sequenced_execution_policy<ExPolicy>::value ||
!hpx::traits::is_forward_iterator<OutIter>::value ||
!hpx::traits::is_forward_iterator<FwdIter>::value
!hpx::traits::is_forward_iterator<FwdIter2>::value ||
!hpx::traits::is_forward_iterator<FwdIter1>::value
> is_seq;
#else
static_assert(
(hpx::traits::is_forward_iterator<FwdIter>::value),
(hpx::traits::is_forward_iterator<FwdIter1>::value),
"Requires at least forward iterator.");
static_assert(
(hpx::traits::is_forward_iterator<OutIter>::value),
(hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least forward iterator.");

typedef execution::is_sequenced_execution_policy<ExPolicy> is_seq;
#endif

return detail::adjacent_difference<OutIter>().call(
return detail::adjacent_difference<FwdIter2>().call(
std::forward<ExPolicy>(policy), is_seq(), first, last, dest,
std::minus<value_type>());
}
Expand All @@ -215,11 +215,11 @@ namespace hpx { namespace parallel { inline namespace v1
/// It describes the manner in which the execution
/// of the algorithm may be parallelized and the manner
/// in which it executes the assignments.
/// \tparam FwdIter The type of the source iterators used for the
/// \tparam FwdIter1 The type of the source iterators used for the
/// input range (deduced).
/// This iterator type must meet the requirements of an
/// forward iterator.
/// \tparam OutIter The type of the source iterators used for the
/// \tparam FwdIter2 The type of the source iterators used for the
/// output range (deduced).
/// This iterator type must meet the requirements of an
/// forward iterator.
Expand All @@ -245,7 +245,7 @@ namespace hpx { namespace parallel { inline namespace v1
/// The signature does not need to have const &, but
/// the function must not modify the objects passed to
/// it. The types \a Type1 must be such
/// that objects of type \a FwdIter can be dereferenced
/// that objects of type \a FwdIter1 can be dereferenced
/// and then implicitly converted to the dereferenced
/// type of \a dest.
///
Expand All @@ -260,49 +260,49 @@ namespace hpx { namespace parallel { inline namespace v1
/// within each thread.
///
/// \returns The \a adjacent_difference algorithm returns a
/// \a hpx::future<OutIter> if the execution policy is of type
/// \a hpx::future<FwdIter2> if the execution policy is of type
/// \a sequenced_task_policy or
/// \a parallel_task_policy and
/// returns \a OutIter otherwise.
/// returns \a FwdIter2 otherwise.
/// The \a adjacent_find algorithm returns an iterator to the
/// last element in the output range.
///
///
template <typename ExPolicy, typename FwdIter, typename OutIter,
template <typename ExPolicy, typename FwdIter1, typename FwdIter2,
typename Op>
inline typename std::enable_if<
execution::is_execution_policy<ExPolicy>::value,
typename util::detail::algorithm_result<ExPolicy, OutIter>::type
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
>::type
adjacent_difference(ExPolicy&& policy, FwdIter first, FwdIter last,
OutIter dest, Op && op)
adjacent_difference(ExPolicy&& policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest, Op && op)
{
#if defined(HPX_HAVE_ALGORITHM_INPUT_ITERATOR_SUPPORT)
static_assert(
(hpx::traits::is_input_iterator<FwdIter>::value),
(hpx::traits::is_input_iterator<FwdIter1>::value),
"Requires at least input iterator.");
static_assert(
(hpx::traits::is_output_iterator<OutIter>::value ||
hpx::traits::is_forward_iterator<OutIter>::value),
(hpx::traits::is_output_iterator<FwdIter2>::value ||
hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least output iterator.");

typedef std::integral_constant<bool,
execution::is_sequenced_execution_policy<ExPolicy>::value ||
!hpx::traits::is_forward_iterator<OutIter>::value ||
!hpx::traits::is_forward_iterator<FwdIter>::value
!hpx::traits::is_forward_iterator<FwdIter2>::value ||
!hpx::traits::is_forward_iterator<FwdIter1>::value
> is_seq;
#else
static_assert(
(hpx::traits::is_forward_iterator<FwdIter>::value),
(hpx::traits::is_forward_iterator<FwdIter1>::value),
"Requires at least forward iterator.");
static_assert(
(hpx::traits::is_forward_iterator<OutIter>::value),
(hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least forward iterator.");

typedef execution::is_sequenced_execution_policy<ExPolicy> is_seq;
#endif

return detail::adjacent_difference<OutIter>().call(
return detail::adjacent_difference<FwdIter2>().call(
std::forward<ExPolicy>(policy), is_seq(), first, last, dest,
std::forward<Op>(op));
}
Expand Down

0 comments on commit 736cb48

Please sign in to comment.