diff --git a/headers/Concepts.hpp b/headers/Concepts.hpp index 187ecc3..9fa061c 100644 --- a/headers/Concepts.hpp +++ b/headers/Concepts.hpp @@ -11,6 +11,8 @@ #define GUARD_TOURMALINE_CONCEPTS_H #include #include +#include +#include namespace Tourmaline::Concepts { template @@ -30,5 +32,29 @@ template requires Either using OppositeOf = _opposite_of::type; +// heavily inspired by +// https://github.com/aminroosta/sqlite_modern_cpp/blob/master/hdr/sqlite_modern_cpp/utility/function_traits.h +template struct FunctionTraits; +template +struct FunctionTraits + : public FunctionTraits< + decltype(&std::remove_reference_t::operator())> {}; + +template +struct FunctionTraits + : FunctionTraits {}; +template +struct FunctionTraits + : FunctionTraits {}; + +template +struct FunctionTraits { + using returnType = Return; + using arguments = std::tuple; + + template + using argument = std::tuple_element_t; + static constexpr std::size_t argumentCount = sizeof...(Arguments); +}; } // namespace Tourmaline::Concepts #endif