Skip to content

Commit

Permalink
Revert "Faster decorator (#5996)"
Browse files Browse the repository at this point in the history
This reverts commit 0ba9198.
  • Loading branch information
lixinqi committed Aug 23, 2021
1 parent f75c4f7 commit 5a68265
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions oneflow/core/common/decorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ struct WithDecorator final {
template<typename T, typename... Args>
struct Decorate<T (*)(Args...)> final {
template<T (*func)(Args...)>
struct FuncPtr final {
static constexpr T (*value)(Args...) = &Decorator<T, Args...>::template Call<func>;
};
static T Call(Args... args) {
return Decorator<T, Args...>::template Call<func>(args...);
}
};
};

#define DECORATE(fn_ptr, decorator) \
static_cast<decltype(fn_ptr)>( \
WithDecorator<decorator>::Decorate<decltype(fn_ptr)>::FuncPtr<fn_ptr>::value)
(&WithDecorator<decorator>::Decorate<decltype(fn_ptr)>::Call<fn_ptr>)

template<typename... Args>
struct ThreadLocalCopiable;
Expand Down

0 comments on commit 5a68265

Please sign in to comment.