Skip to content

Commit

Permalink
Proper invoke_result_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenhater committed Sep 10, 2024
1 parent 72e9fbe commit 097938d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions arbor/include/arbor/util/uninitialized.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ class uninitialized {

// Apply the one-parameter functor F to the value by reference.
template <typename F>
std::invoke_result_t<F(reference)> apply(F&& f) { return f(ref()); }
std::invoke_result_t<F, reference> apply(F&& f) { return f(ref()); }

// Apply the one-parameter functor F to the value by const reference.
template <typename F>
std::invoke_result_t<F(const_reference)> apply(F&& f) const { return f(cref()); }
std::invoke_result_t<F, const_reference> apply(F&& f) const { return f(cref()); }
};

/*
Expand Down
8 changes: 3 additions & 5 deletions arbor/util/rangeutil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,9 @@ bool equal(const Seq1& seq1, const Seq2& seq2, Eq p = Eq{}) {
// (TODO: this will perform unnecessary copies if `proj` returns a reference;
// specialize on this if it becomes an issue.)

template <
typename Seq,
typename Proj,
typename Compare = std::less<std::invoke_result<Proj (typename sequence_traits<const Seq&>::value_type)>>
>
template <typename Seq,
typename Proj,
typename Compare = std::less<std::invoke_result_t<Proj, typename sequence_traits<const Seq&>::value_type>>>
bool is_sorted_by(const Seq& seq, const Proj& proj, Compare cmp = Compare{}) {
using std::begin;
using std::end;
Expand Down

0 comments on commit 097938d

Please sign in to comment.