diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-02-17 00:21:48 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-02-17 22:29:50 +0100 |
commit | a141c401f78467bc15f62882fca5d55a007cacbb (patch) | |
tree | 908ac71a8640f78f45d22c6808c5fa6e373000fa /asl/functional.hpp | |
parent | cb77cbe9ce4cddad6a460aa190ff70f0c13e4703 (diff) |
Reorganize everything
Diffstat (limited to 'asl/functional.hpp')
-rw-r--r-- | asl/functional.hpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/asl/functional.hpp b/asl/functional.hpp deleted file mode 100644 index f5ff0d9..0000000 --- a/asl/functional.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include "asl/meta.hpp" -#include "asl/utility.hpp" - -namespace asl { - -template<typename... Args, typename C> -constexpr auto invoke(is_func auto C::* f, auto&& self, Args&&... args) - requires requires { - (self.*f)(ASL_FWD(args)...); - } -{ - return (ASL_FWD(self).*f)(ASL_FWD(args)...); -} - -template<typename... Args, typename C> -constexpr auto invoke(is_func auto C::* f, auto* self, Args&&... args) - requires requires { - (self->*f)(ASL_FWD(args)...); - } -{ - return (self->*f)(ASL_FWD(args)...); -} - -template<typename... Args, typename C> -constexpr auto invoke(is_object auto C::* m, auto&& self, Args&&...) - requires ( - sizeof...(Args) == 0 && - requires { self.*m; } - ) -{ - return ASL_FWD(self).*m; -} - -template<typename... Args, typename C> -constexpr auto invoke(is_object auto C::* m, auto* self, Args&&...) - requires ( - sizeof...(Args) == 0 && - requires { self->*m; } - ) -{ - return self->*m; -} - -template<typename... Args> -constexpr auto invoke(auto&& f, Args&&... args) - requires requires { - f(ASL_FWD(args)...); - } -{ - return ASL_FWD(f)(ASL_FWD(args)...); -} - -template<typename F> struct _result_of_helper; - -template<typename R, typename... Args> -struct _result_of_helper<R(Args...)> -{ - using type = decltype(invoke(declval<R>(), declval<Args>()...)); -}; - -template<typename F> using result_of_t = _result_of_helper<F>::type; - -} // namespace asl |