Files
fennec/include/fennec/math/vector_traits.h
Medusa Slockbower db7d52c86c - Fixed Documentation for Consistency
- Added more documentation, predominantly in the Math Library
2025-06-16 01:48:31 -04:00

73 lines
2.7 KiB
C++

// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// 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 <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file vector_traits.h
/// \brief part of the \ref fennec_math_vector
///
///
/// \details this header implements functions to test vector types at compile time
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#ifndef FENNEC_MATH_VECTOR_TRAITS_H
#define FENNEC_MATH_VECTOR_TRAITS_H
#include <fennec/math/detail/__vector_traits.h>
namespace fennec
{
///
/// \brief check if \p T is a fennec::vector type
/// \tparam T type to check
template<typename T> struct is_vector : detail::__is_vector_helper<remove_cvr_t<T>>{};
///
/// \brief shorthand for ```is_vector<T>::value```
/// \tparam T type to check
template<typename T> constexpr bool is_vector_v = is_vector<T>::value;
///
/// \brief Get the number of Components in \p T, returns 1 for types that pass ```is_arithmetic<T>```, returns \ref vector::N for \ref vector "Vector" Types, and returns 0 for all other cases
/// \tparam T type to check
template<typename T> struct component_count : detail::__component_count_helper<remove_cvr_t<T>>{};
///
/// \brief shorthand for ```component_count<T>::value```
/// \tparam T type to get the component count of
template<typename T> constexpr size_t component_count_v = component_count<T>::value;
///
/// \brief Get the total number of Components among types in \p TypesT
/// \tparam Ts types to accumulate the count of
template<typename...Ts> struct total_component_count : integral_constant<size_t, (component_count_v<Ts> + ...)>{};
///
/// \brief shorthand for ```component_count<T>::value```
/// \tparam Ts types to accumulate the count of
template<typename...Ts> constexpr size_t total_component_count_v = total_component_count<Ts...>::value;
}
#endif // FENNEC_MATH_VECTOR_TRAITS_H