Skip to content

Commit 2495318

Browse files
yoneyfacebook-github-bot
authored andcommitted
Use std library
Summary: Replace macro with requires constraint. Reviewed By: alexmalyshev Differential Revision: D79450308 fbshipit-source-id: e03a0c0b31e66804c39aec687b6c942def1de857
1 parent 4e26f29 commit 2495318

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

cinderx/Common/util.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,6 @@ struct FreeDeleter {
276276
template <typename T>
277277
using unique_c_ptr = std::unique_ptr<T, FreeDeleter>;
278278

279-
#include <concepts>
280-
281-
#define REQUIRES_CALLABLE(...) requires jit::Callable<__VA_ARGS__>
282-
// Similar to std::invocable<F, Args...>, but also constrains the return type.
283-
template <typename F, typename Ret, typename... Args>
284-
concept Callable = requires(F f, Args&&... args) {
285-
{ f(std::forward<Args>(args)...) } -> std::convertible_to<Ret>;
286-
};
287-
288279
template <class T>
289280
class ScopeExit {
290281
public:

cinderx/Jit/runtime.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "cinderx/module_state.h"
2323

2424
#include <optional>
25+
#include <type_traits>
2526
#include <unordered_map>
2627
#include <unordered_set>
2728
#include <vector>
@@ -462,7 +463,7 @@ class Runtime : public IRuntime {
462463
#if PY_VERSION_HEX < 0x030C0000
463464
// In 3.12+ the equivalent of this is in generators_rt.cpp.
464465
template <typename F>
465-
REQUIRES_CALLABLE(F, int, PyObject*)
466+
requires std::is_invocable_r_v<int, F, PyObject*>
466467
int forEachOwnedRef(PyGenObject* gen, std::size_t deopt_idx, F func) {
467468
const DeoptMetadata& meta = getDeoptMetadata(deopt_idx);
468469
auto base = reinterpret_cast<char*>(genDataFooter(gen));

0 commit comments

Comments
 (0)