Skip to content

Commit

Permalink
apply can't be using on gcc 11/clang 14?
Browse files Browse the repository at this point in the history
  • Loading branch information
cageq committed Jul 18, 2023
1 parent aaedc73 commit 0017b90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions common/tuple-assistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,15 @@ constexpr inline decltype(auto) apply(F&& f, Tuple&& t) {
}

#else
template <typename F, typename Tuple>
using template std::apply<F, Tuple>;
// template <typename F, typename Tuple>
// using template std::apply<F, Tuple>;


template <typename F, typename Tuple>
constexpr decltype(auto) apply(F && f, Tuple && t){
return std::apply(std::forward<F>(f), std::forward<Tuple>(t));
}

#endif

template <typename P, size_t I, typename... Ts>
Expand Down
7 changes: 4 additions & 3 deletions thread/thread11.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace photon {
static void* __stub11(void*) {
using Pair = std::pair<F, SavedArgs>;
auto p = thread_reserved_space<Pair>(CURRENT);
tuple_assistance::apply(p->first, SavedArgs{p->second});
tuple_assistance::apply(p->first, SavedArgs{std::move(p->second)});
return nullptr;
}

Expand All @@ -49,9 +49,10 @@ namespace photon {
template<typename FUNCTOR, typename...ARGUMENTS>
struct FunctorWrapper {
typename std::decay<FUNCTOR>::type _obj;
using result_type = typename std::result_of<FUNCTOR(ARGUMENTS...)>::type;
__attribute__((always_inline))
void operator()(ARGUMENTS&&...args) {
_obj(std::forward<ARGUMENTS>(args)...);
result_type operator()(ARGUMENTS&&...args) {
return _obj(std::forward<ARGUMENTS>(args)...);
}
};

Expand Down

0 comments on commit 0017b90

Please sign in to comment.