/** This file is a part of our_dick Copyright (C) 2020 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ #ifndef REXY_MATH_FWD_DECLARE_HPP #define REXY_MATH_FWD_DECLARE_HPP #include //size_t #include #include //Provide aliases for common matrix, vector, and quaternion types namespace math{ template struct is_vector; template struct is_quaternion; template struct is_matrix; template concept Quaternion = is_quaternion::value; template concept Matrix = is_matrix::value; template concept Vector = is_vector::value; template concept Scalar = !Matrix && !Vector && !Quaternion && requires(std::decay_t t){ {t += t} -> std::convertible_to; {t -= t} -> std::convertible_to; {t /= t} -> std::convertible_to; {t *= t} -> std::convertible_to; {t + t} -> std::convertible_to>; {t - t} -> std::convertible_to>; {t / t} -> std::convertible_to>; {t * t} -> std::convertible_to>; {-t} -> std::convertible_to>; {t > t} -> std::convertible_to; {t < t} -> std::convertible_to; {t >= t} -> std::convertible_to; {t <= t} -> std::convertible_to; {t == t} -> std::convertible_to; {t != t} -> std::convertible_to; }; template class matrix_base; template class matrix; template class vector; template class quaternion; template using mat2 = matrix; template using mat3 = matrix; template using mat4 = matrix; template using vec2 = vector; template using vec3 = vector; template using vec4 = vector; using vec2f = vec2; using vec2i = vec2; using vec2u = vec2; using vec2d = vec2; using vec2s = vec2; using vec2b = vec2; using vec3f = vec3; using vec3i = vec3; using vec3u = vec3; using vec3d = vec3; using vec3s = vec3; using vec3b = vec3; using vec4f = vec4; using vec4i = vec4; using vec4u = vec4; using vec4d = vec4; using vec4s = vec4; using vec4b = vec4; using mat2f = mat2; using mat2i = mat2; using mat2u = mat2; using mat2d = mat2; using mat2s = mat2; using mat2b = mat2; using mat3f = mat3; using mat3i = mat3; using mat3u = mat3; using mat3d = mat3; using mat3s = mat3; using mat4f = mat4; using mat4i = mat4; using mat4u = mat4; using mat4d = mat4; using mat4s = mat4; using mat4b = mat4; template using quat = quaternion; using quat_f = quat; using quat_i = quat; using quat_u = quat; using quat_d = quat; using quat_s = quat; using quat_b = quat; namespace detail{ template struct is_matrix_helper { template static std::true_type test(matrix_base*); static std::false_type test(void*); static constexpr bool value = std::is_same*>(nullptr)))>::value; }; template struct is_quat_helper { template static std::true_type test(quaternion*); static std::false_type test(void*); static constexpr bool value = std::is_same*>(nullptr)))>::value; }; template struct is_vector_helper { template static std::true_type test(vector*); static std::false_type test(void*); static constexpr bool value = std::is_same*>(nullptr)))>::value; }; } template struct is_vector{ static constexpr bool value = (detail::is_vector_helper::value && ...); }; template struct is_quaternion { static constexpr bool value = (detail::is_quat_helper::value && ...); }; template struct is_matrix { static constexpr bool value = (detail::is_matrix_helper::value && ...); }; template concept Compatible_Scalar = requires(T&& t, U&& u){ requires !is_matrix::value; requires std::is_convertible_v>; requires std::is_convertible_v>; requires std::is_convertible_v>; requires std::is_convertible_v>; }; } #endif