Open MikeDvorskiy opened 7 months ago
At least, const T&
(instead of T&&
) breaks binary_search.pass
test.
error: static assertion failed due to requirement '::std::is_invocable_v<(lambda at /home/sdp/mdvorski/oneDPL/make/../include/oneapi/dpl/internal/binary_search_impl.h:120:35), const unsigned long &>': A predicate cannot be called with the passed arguments
302 | static_assert(::std::is_invocable_v<_Pred, _Args...>, "A predicate cannot be called with the passed arguments");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sdp/mdvorski/oneDPL/make/../include/oneapi/dpl/pstl/hetero/dpcpp/../../utils.h:293:9: note: in instantiation of function template specialization 'oneapi::dpl::__internal::__transform_functor<(lambda at /home/sdp/mdvorski/oneDPL/make/../include/oneapi/dpl/internal/binary_search_impl.h:120:35)>::__transform_impl<unsigned long &, const unsigned long &>' requested here
293 | __transform_impl(::std::forward<_OutputType>(__output), __x);
error: no matching function for call to object of type '(lambda at /home/sdp/mdvorski/oneDPL/make/../include/oneapi/dpl/internal/binary_search_impl.h:120:35)'
303 | ::std::forward<_OutputType>(__output) = _M_pred(::std::forward<_Args>(__args)...);
| ^~~~~~~
/home/sdp/mdvorski/oneDPL/make/../include/oneapi/dpl/internal/binary_search_impl.h:120:35: note: candidate function not viable: 1st argument ('const unsigned long') would lose const qualifier
120 | [=](typename ::std::iterator_traits<InputIterator2>::reference val) {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1) TODO: to do the same fix for output type (by re-using transform_functor if applicable) for the other functor below: __transform_if_unary_functor, transform_if_binary_functor, __replace_functor, __replace_copy_functor 2) TODO: to make input type consistently: const T& or T&&; to think which way is preferable
_Originally posted by @MikeDvorskiy in https://github.com/oneapi-src/oneDPL/pull/1233#discussion_r1463205525_
Proposed Implementation:
3) Also to investigate whether be any issue with another
const tuple_type&
(andstd::get
) place in the code: https://github.com/oneapi-src/oneDPL/blob/main/include/oneapi/dpl/pstl/utils_ranges.h#L140