#pragma once /* * Copyright (C) 2024 Brett Terpstra * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef BLT_META_FUNCTION_H #define BLT_META_FUNCTION_H #include #include namespace blt::meta { struct std_function_tag {}; struct function_ptr_tag {}; struct lambda_tag {}; struct member_function_ptr_tag {}; template struct function_like; template struct function_like> { using return_type = Return; using args_tuple = std::tuple; using tag = std_function_tag; }; template struct function_like { using return_type = Return; using args_tuple = std::tuple; using tag = function_ptr_tag; }; template struct function_like { using return_type = Return; using args_tuple = std::tuple; using tag = function_ptr_tag; }; template struct function_like { using return_type = Return; using args_tuple = std::tuple; using tag = member_function_ptr_tag; using class_type = Class; }; template struct function_like { using return_type = Return; using args_tuple = std::tuple; using tag = member_function_ptr_tag; using class_type = Class; }; template struct function_like { using return_type = Return; using args_tuple = std::tuple; using tag = member_function_ptr_tag; using class_type = Class; }; template struct function_like { using return_type = Return; using args_tuple = std::tuple; using tag = member_function_ptr_tag; using class_type = Class; }; template struct function_like { private: template struct lambda_traits {}; template struct lambda_traits { using return_type = Return; using args_tuple = std::tuple; using class_type = Class; }; template struct lambda_traits { using return_type = Return; using args_tuple = std::tuple; using class_type = Class; }; template struct lambda_traits { using return_type = Return; using args_tuple = std::tuple; using class_type = Class; }; template struct lambda_traits { using return_type = Return; using args_tuple = std::tuple; using class_type = Class; }; using lambda_trait = lambda_traits; public: using tag_type = lambda_tag; using return_type = typename lambda_trait::return_type; using args_tuple = typename lambda_trait::args_tuple; using class_type = typename lambda_trait::class_type; }; } #endif //BLT_META_FUNCTION_H